Why am I getting this error when testing on a IPAD? - ios

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* +[NSString stringWithUTF8String:]: NULL cString'
* First throw call stack:
(0x374ec8bf 0x362cb1e5 0x374ec7b9 0x374ec7db 0x31dade97 0x278f 0x2c2d 0x307877eb 0x307813bd 0x3074f921 0x3074f3bf 0x3074ed2d 0x36000e13 0x374c0553 0x374c04f5 0x374bf343 0x374424dd 0x374423a5 0x30780457 0x3077d743 0x2439 0x23d0)
terminate called throwing an exception
I just don't understand why it was working until 5 minutes ago testing it on the same thing and now it's not working anymore. What can I do to solve this problem? The application works fine on the simulator.

Your string cString = null..
Fill it.

Where do you get the string? One of the more common reasons for "works on Simulator but not device" is that you are reading from a file and use the wrong case -- device has case-sensitive file systems, but Macs have case-insensitive (typically).

The reason why it didn't work on the device is because I modified the database and for some reason the one on the device was the wrong one which obviously was incompatible with the new code. After I deleted the application from the Ipod and then ran it again it worked just fine.
The reason why I had that specific error is because some variables that were holding database columns were empty.

Related

Error only on iOS 9 devices

I can't get my app to run now on certain devices.
int retVal = UIApplicationMain(argc, argv, nil, #"AppController"); <---SIGABRT
In the console I get...
-[BAPushCenter (null selector)]: unrecognized selector sent to instance 0x8a22960
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[BAPushCenter (null selector)]: unrecognized selector sent to instance 0x8a22960'
*** First throw call stack:
(0x2502386b 0x369d6dff 0x25029035 0x369f1a4b 0x25028244 0x24f528e5 0x24f56377
0x1cfa1 0x25026b31 0x24f562b8 0x291baa29 0x293cd61d 0x293e0381 0x293ca91f
0x2d18dccd 0x2d18dfb90x24fe6827 0x24fe6417 0x24fe477f 0x24f371e9 0x24f36fdd
0x291a143f 0x2919c18d 0x2a70d3 0x37101873)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I have no idea what BAPushCenter is, I did a project search and can't find it anywhere. I used an exception breakpoint but it didn't show me any more information then original error.
Update: After testing more devices the error only seems to occur on iOS 9 devices. But iOS 9 simulator devices and any other device below iOS 9 work fine. Any ideas?
In my case, because of the "Batch Framework" my app crashes
Figured it out. The class was coming from one of my static libs so i wasn't able to search it. When I figured out what lib was causing the issues I completely removed it from my app and it compiled fine. Once I get an updated version of that lib I'll put it back in my app, thanks.

Swift 2.0 NSPlaceholderDictionary attempt to insert nil object from objects[0]

I ran into a problem which I seem to can't fix.
Whenever I try to run my app (XCode 7 BETA 2) on my device (iOS 9 BETA 2) it crashes at AppDelegate with the following error:
2015-06-24 04:12:46.769 eSports Center 2[1472:96321] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x18433738c 0x1989dbf2c 0x184224da8 0x184224c40 0x100204efc 0x10020508c 0x1001fc968 0x1002027c8 0x18422d360 0x18422d1d0 0x100201f74 0x1001fc3f8 0x1898be414 0x1890f23c0 0x1890ed008 0x1898d48c4 0x1002281bc 0x1898be414 0x1890f23c0 0x1890ed008 0x1898d48c4 0x189981188 0x18997ec00 0x189997048 0x189996d58 0x189996a60 0x1898fc19c 0x1898fa518 0x18998a974 0x1899808c0 0x18997fa90 0x18997f6b8 0x18997f620 0x1898be414 0x1890f23c0 0x1890ed008 0x1890ecec8 0x1890ec594 0x1890ec2e8 0x1890e5ab8 0x1842ee39c 0x1842ec114 0x1842190f0 0x18992f838 0x18992a5f0 0x1001192ac 0x19921a8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
When I try to run it on the Simulator everything is fine. The App itself is a recode of my current project in Swift 2.0 with some pods (for the first time).
It includes 3 libs and some basic UI stuff, I tried to setup the first TabController tab.
Someone has an idea of how to fix them?
Everything Is working now. One library I'm using, tried to load a Font which wasn't available on my iPhone but on my Simulator (?).
Thanks for all the help, Breakpoint and stepping through the Library code did the trick!

Why am I getting a `unrecognized selector sent to instance` error?

I have a Ruby on Rails application that has an API, it's an OAuth 2.0 provider and uses Doorkeeper. I am creating an iPhone client for that application and am using the gtm-oauth2 library for authentication. Here is the Github repository for the iPhone app.
I manage do the authentication request using the library and get the response from the OAuth server, but (I think that) when the iPhone app receives the response, the iPhone app crashes. I get the following error:
2013-03-25 07:30:51.563 Catapult for iOS[68917:c07] -[NSNull length]: unrecognized selector sent to instance 0x14f2678
2013-03-25 07:30:51.564 Catapult for iOS[68917:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x14f2678'
*** First throw call stack:
(0x13c1012 0x11e6e7e 0x144c4bd 0x13b0bbc 0x13b094e 0xf074 0x185e3 0x13b51bd 0x13b50d6 0x1531a 0x1512b 0x14ae2 0x13b51bd 0x13b50d6 0x11d0a 0x1032a 0x13b51bd 0x13b50d6 0x79be 0x77ed 0x8cf2 0xcec589 0xcea652 0xceb89a 0xcea60d 0xcea785 0xc37a68 0x4a2a911 0x4a29bb3 0x4a67cda 0x13638fd 0x4a6835c 0x4a682d5 0x4952250 0x1344f3f 0x1344a39 0x1367734 0x1366f44 0x1366e1b 0x22be7e3 0x22be668 0x12affc 0x2c6d 0x2b95)
libc++abi.dylib: terminate called throwing an exception
I am a complete noob/beginner when it comes to iOS development and Objective-C programming, and I am learning how to create my first app using this little project. I asked the same question in the gtm-oaut2 Google Group and according to them, the problem comes from my code and not the library. The problem is that all of my code is taken from their wiki and I can't pinpoint where the app crashes. If I understand correctly, at some point I am calling length of NSNull, but I am not calling length anywhere, hence my confusion. Also, when the app crashes, the line hilighted is in the main.m file and the error (on the right label, not in the output) is the following:
Thread 1: signal SIGABRT
I have no clue what that means...
Does anyone know what the problem might be please?
You're right that the issue is that somewhere you've got the length message being sent to an instance of NSNull. To pinpoint where exactly this is happening set a breakpoint on objc_exception_throw. You can do this in the Xcode UI with little "+" button in the bottom left corner on the breakpoints tab. Select "Add Exception breakpoint." Then the debugger will stop your program at the point where the error occurs instead of waiting for the program to actually crash.
Well... you understood the error correctly.. You are somewhere calling length on a NSNull instance.
I must find out where this is happening.
I think this is happening in a JSON response. Maybe you (or "the code") is calling length on something it expects its a NSString but it is instead NSNull (that is the json has a NULL value).
Try if you manage to print the json response and see if you found a key mapped to a null value...
NSNull does not respond to length
You can check the documentation for NSNull to see that this is the case.
Without having an idea of what your code base is doing I am not sure where to look, you must be calling [NSNull null]; at some point to get the NSNull object or you are using a framework somewhere that returns this.

ios understand the SIGABRT in my block

I have a block that fires once my image is downloaded. the data coming in from the block is the image. I'm not sure why I'm getting a SIGABRT though. This works fine on the first load, but when I come back to this same spot I always crash out the second time.
Everything you would want to see should be in the bottom left and printed out on the bottom right in the following order: data, ptr, ptr->imageImg
** EDIT **
I forgot to add the stack dump as well
2012-06-21 15:52:59.119 iPhone App[25327:16a03] -[UIImage length]: unrecognized selector sent to instance 0x10e41b80
2012-06-21 15:52:59.120 iPhone App[25327:16a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage length]: unrecognized selector sent to instance 0x10e41b80'
*** First throw call stack:
(0x1c35022 0x37dccd6 0x1c36cbd 0x1b9bed0 0x1b9bcb2 0x68e97a 0x5612c8 0x56102b 0x1be82 0x2afbc 0x46ad330 0x46af509 0x1b6c803 0x1b6bd84 0x1b6bc9b 0x1dc77d8 0x1dc788a 0x546626 0x28704 0x20d5)
terminate called throwing an exception(lldb)
You're calling length on UIImage, but UIImage doesn't have a method called length.
After hours of trying not to pull my hair out, I finally figured it out.
the situation
I have a caching system to cache a file on download and then send the stored version back to my callback. For some reason I was trying to save to a filepath that had a question mark (and other symbols) in it which apparently would NOT let ios save the file to the device *note xcode nor the device ever warned me that the file wasn't be saved either. However the record keeping system was showing that everything was working fine which meant the data sent back was empty NSData.
the solution
I made sure that my filepath had NO symbols in it when saving offline data and viola.

XCode4 Debugger Always Breaks in Main

After upgrading to XCode4 (v. 4.2, 4D199) it seems every time my apps crash while debugging, the debugging points to main(), and the stack is unsymbolicated and useless.
This has been working fine for years, I have no idea what has gone wrong.
I'm using GDB. I also tried the LLDB as per this advice, and it didn't work either (similar, useless stack).
My breakpoints work, I get the full stack, and can inspect variables when my code hits those.
Steps to reproduce:
NB. this happens with my own project, but I'll use Apple's code here to remove that variable from the equation
Download the following sample from Apple: https://developer.apple.com/library/ios/#samplecode/UICatalog/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007710
In the ImagesViewController class, add the following code to the viewDidLoad method (so it will crash – we want it to crash for this test):
// please note: this code is designed to crash! I want it to crash, to highlight my issue with XCode.
NSMutableArray* test = [NSMutableArray new];
[test insertObject:NULL atIndex:0];
Then run the app & hit the 'Images' row.
It crashes with a message like:
2011-12-23 14:07:02.788 UICatalog[13394:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x37bbb8bf 0x316a11e5 0x37b1020f 0x699f 0x34fac7ff 0x34fb8c39 0x34fb8aa9 0x34fb898f 0x34fb815b 0x34fb7f53 0x34fac673 0x34fac349 0x66c1 0x35026565 0x3509ece7 0x31aec943 0x37b8fa63 0x37b8f6c9 0x37b8e29f 0x37b114dd 0x37b113a5 0x3768ffcd 0x34fa1743 0x2459 0x2418)
terminate called throwing an exception(gdb)
View in xcode:
Thanks to brigadir for pointing me to the solution!
It works well. Here's some screenshots for how to solve this for anyone finding my question:
Tap the plus button of the breakpoints tab
Then click Done

Resources