ios understand the SIGABRT in my block - ios

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.

Related

Cannot start any Tabris 1.0 application on iOS

Sorry, but I wasn't sure whether to post Tabris questions here or on GitHub, now that 1.0 is available? This is a dup of one I just raised on GitHub...
I've had Tabris 1.0 for a few days now, running ok on browser and Android, but I cannot get the iOS client to start at all. Here is my error in XCode, which is the same whether it is an emulated device or a real iPad:
2013-04-24 09:45:53.616 RapHello[2636:907] * 17 DAY(S) OF TABRIS TRIAL LEFT
2013-04-24 09:45:53.620 RapHello[2636:907] -[AppDelegate clientDidBecomeReady]: unrecognized selector sent to instance 0x1e51fb70
2013-04-24 09:45:53.621 RapHello[2636:907] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate clientDidBecomeReady]: unrecognized selector sent to instance 0x1e51fb70'
* First throw call stack:
(0x343ae3e7 0x3c238963 0x343b1f31 0x343b0737 0x34308208 0x342ff349 0x34c16b7f 0x361c3d11 0x36215b7d 0x361bdd1f 0x361bd7ad 0x361bd1ef 0x37eb15f7 0x37eb1227 0x343833e7 0x3438338b 0x3438220f 0x342f523d 0x342f50c9 0x3621446d 0x362112b9 0xb7981 0xb7908)
libc++abi.dylib: terminate called throwing an exception
This happens quite early on. I see the TABRIS logo screen on the device, but then this crash and nothing else happens.
Any ideas what I'm doing wrong - obviously something quite basic.
Thanks, John
To fix that problem you need to add the following method to your AppDelegate.m :
- (void)clientDidBecomeReady {
/*
Called when the Tabris client did become ready and will start a new session.
*/
}
We will fix this in our trial download asap.

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 Button Target Actions with Block Crashes

I'm implementing UIButtons with block actions set on them for connivence and speed of integration. I've used this method before, a while ago now, and had little issue with it. Now, however, i'm facing an issue where integrating...
https://gist.github.com/2468899
... into my app now crashes it on launch. The error i'm receiving is as follows...
2012-09-27 22:18:47.459 flink[12174:907] -[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610
2012-09-27 22:18:47.460 flink[12174:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610'
*** First throw call stack:
(0x3885a3e7 0x333bf963 0x3885df31 0x3885c64d 0x387b4208 0xea477 0xff6af 0x36b92cb1 0x3882f8f7 0x3882f15d 0x3882df2f 0x387a123d 0x387a10c9 0x3868c33b 0x34014289 0xe7b8f 0xe7b30)
libc++abi.dylib: terminate called throwing an exception
... i've never seen this issue before but it's odd that it is immediately crashing without any interaction.
Thanks in advanced.
You must make sure to add the implementation file of the category to your target. In Xcode, go to the File Inspector and make sure the Target Membership checkbox for your target is checked.

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

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

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.

Resources