cocos2d errors when changing iOS target - ios

I have an iOS app which has been using cocos2dx. The app works fine when the app and the cocos library both target iOS 6 but when I change it to 7 or 8 i suddenly get this error appearing.
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: basic_string
Why does this appear all of a sudden

This is most likely a crash in your code, iterating over a string and accessing out of bounds.
Try debugging your application in XCode and adding a breakpoint for all exceptions:
http://blog.manbolo.com/2012/01/23/xcode-tips-1-break-on-exceptions
You can then follow the call stack up into the offending code.

Related

iOS Simulator Quits: reason: '-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished]

as the title indicates, I have an app in development in Xcode, using the iPhone simulator to test. I've started getting this :
uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished]
Previously, I had the IQKeyboard cocoa pod handling the layout, so fields would be accessible in landscape format, but a change of layout eliminated the need for that, and it was removed, along with all calls to it. I doubt this is the answer, but I'm mentioning it in case.
I am using a physical keyboard during testing. This problem has not previously cropped up in weeks of development.

Unrecognized selector UIDeviceRGBColor countByEnumeratingWithState:objects:count:

I know this is kind of a dupe, but I don't have enough reputation yet to comment on the original post and, while I don't have an answer, I do have more useful information (a concrete example). Moderators, feel free to move this to the proper location.
When compiling my code using the latest XCode 8 beta 6 (iOS 10 SDK), I get an exception "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x600000071340'"
This happens during the call:
auto viewController = [[[UIViewController alloc] initWithNibName:#"ViewController" bundle:nil] autorelease];
I have isolated the problem by whittling down my project to the bare minimum that will compile and still exhibit the problem. You can download it here:
Example project
Note that I took out lots of code, nearly all classes are gone, which results in a lot of warnings (not errors) for nonexistent classes referenced from the xib. But that doesn't matter, the code still compiles and runs just fine with the iOS 9 SDK. After compiling with the iOS 10 sdk, however, it crashes both in the simulator and on devices running iOS 9.
You can work around the problem by changing "#if 0" into "#if 1" in the file "HackForUnrecognizedSelectorInIOS10.m". This adds a category defining the missing selectors for UIColor. But obviously you can't add that to shipping code, it's just a temporary stopgap measure to continue developing.
I filed a bug report (28153870). But if anyone has any more information on how to avoid this problem without ugly hacks, any information is welcome.
Thanks
Michel Colman
When I try to compile and run my project with the same configuration (XCode 8 beta 6, iOS 10 SDK), I encountered a similar issue, except that my error message was:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor length]: unrecognized selector sent to instance 0x600000479280'
And I noticed that this issue only occurs when the view is init by using interface files, i.e. Xib and Nib. I solved this issue by:
Open your interface file, in the right panel, navigate to the File Inspector tab.
Change the attribute highlighted to "iOS 7.0 and Later" (or whatever iOS version later)
Then compile and run your project again, this should fix your issue, though I am not sure about the reason behind this. I tried the same with your sample project and it solves the issue too.
In my case, I needed to change the project deployment target to 8.0 in the product general settings. Thanks to the hint from the accepted answer!

App Crashes after Project and Scheme Renames Xcode 8 Swift 2.3

After renaming my Xcode project, scheme, and target, my app crashes at the App Delegate when running in simulator. It should be noted that the app could be run successfully, without any errors, prior to the rename. I have attempted all manner of fixes including editing the project.pbxproj file, all to no avail. The app crashes with an "libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)" error at Thread 1 main.
Any assistance solving the problem would be greatly appreciated.

iOS 10 Beta SDK - [UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector

When our iOS application is compiled on iOS 10 Developer Preview SDK, when launching one of the first view controllers of the application, the application crashes with this exception :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x17adb5a0'
*** First throw call stack:
(0x23c9b91b 0x23436e17 0x24474da3 0x24474f5f 0x24447e81 0x24446f25 0x286c8a0b 0x2857baa3 0x2834effb 0x28214a1f 0x28214971 0x28aa9ec1 0x28560d01 0x285846e5 0x28586d65 0x28223541 0x28586ca9 0x28586f91 0x2830ddb9 0x28586fcf 0x1c13b3 0x1beb89 0x1bf927 0x244c6655 0x23c5e58f 0x23c5e1c1 0x23c5c00d 0x23bab229 0x23bab015 0x2519bac9 0x2827d189 0xe3b65 0x23853873)
libc++abi.dylib: terminating with uncaught exception of type NSException
In the code of our application, this selector of UIDeviceRGBColor is never called.
Does someone have the same problem ? Is it a bug of iOS 10 Beta ?
When compiled with iOS 10 Beta SDK, the problem occurs as well on devices running on iOS 10 Beta as on iOS 9.
The problem does not appear (not on iOS 10, not on iOS 9) when the application is compiled with iOS 9 SDK
Thank you.
Best regards.
In case your are using interface files like Xib and Nib for your views, refer to my answer in this question
Quoted from that question:
When I try to compile and run my project with the same configuration (XCode 8 beta 6, iOS 10 SDK), I encountered a similar issue, except that my error message was:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor length]: unrecognized selector sent to instance 0x600000479280'
And I noticed that this issue only occurs when the view is init by using interface files, i.e. Xib and Nib. I solved this issue by:
Open your interface file, in the right panel, navigate to the File Inspector tab.
Change the attribute highlighted to "iOS 7.0 and Later" (or whatever iOS version later)
Then compile and run your project again, this should fix your issue, though I am not sure about the reason behind this.

How to detect reason of "Terminating app due to uncaught exception" error?

I'm working on card game (turn based) and I have one problem. When I'm in the game, I click on home button to exit the game and then I enter the game again and I get this error: Terminating app due to uncaught exception...
How can I detect reason and place of this error? Is there any method or settings in xcode for that?
My Xcode version: 4.5.2
I get this error on my iPhones (4S and 5), bit not when I try on iPhone simulator.
P.S. With PHP errors are simple because for example you get thid: there is an error on line: 45
Update. The error is:
[ViewController interruption:]: unrecognized selector sent to instance 0x1c54d260

Resources