Search code examples
objective-crubymotion

App crashes in simulator but not on device


I am building an iOS app using Rubymotion and when I run the project in the simulator I get this error:

app_delegate.rb:31:in `application:didFinishLaunchingWithOptions:': NSInvalidArgumentException: -[NSNull pointSize]: unrecognized selector sent to instance 0x1639cd8 (RuntimeError)

But when I run it on the device it does not crash. I got iOS 6 on the device and iOS5 on the simulator.

This is the line that crashes:

UINavigationController.alloc.initWithRootViewController(firstViewController)

When I comment out all instances of setTitleTextAttributes in the app it works. This is a few examples of how I use it:

aboutController.tabBarItem.setTitleTextAttributes({UITextAttributeFont => tabFont}, forState:UIControlStateNormal)

aboutNavController.navigationBar.setTitleTextAttributes({UITextAttributeFont => titleFont})

I guess it is a iOS5 issue? Am I using it correctly?


Solution

  • I believe your navigationBar titleTextAttributes need to be set like an accessor:

    aboutNavController.navigationBar.titleTextAttributes = {UITextAttributeFont => titleFont}
    

    Apple docs reference:

    http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html