Question

This issue is specific to RestKit, but I believe the underlying issue is related to registering to notifications. I could really use some help figuring this one out...I seem to be having the same issue appearing multiple times:

An NSInvalidArguementException coming from serviceDidBecomeUnavailableNotification within RKClient. The action is calling from __NSMallocBlock__, __NSCFString, __NSCFArray, NSURL, and UICFFont... obviously the delegate is not being set correctly.

It is ONLY in my requests using RKObjectMapping to map the response to my model classes. I've noticed the objectLoader has isResponseMappable and checks [self.response isServiceUnavailable] - which then posts a RKServiceDidBecomeUnavailableNotification. This seems to be where my issue is coming from. The only place I see isResponseMappable being called is within didFinishLoad:(RKResponse*)response.

Here's an example stack trace, I thought this could be very beneficial:

Error Message: 
NSInvalidArgumentException: -[__NSMallocBlock__ 
serviceDidBecomeUnavailableNotification:]: unrecognized selector sent 
to instance 0xee168b0 

CoreFoundation:2:in `0x37d4dacb -[NSObject doesNotRecognizeSelector:] 
+ 174' 
CoreFoundation:3:in `0x37d4c945 ___forwarding___ + 300' 
CoreFoundation:4:in `0x37ca7680 _CF_forwarding_prep_0 + 48' 
Foundation:5:in `0x31c6f50f __57-[NSNotificationCenter 
addObserver:selector:name:object:]_block_invoke_0 + 18' 
CoreFoundation:6:in `0x37d16577 ___CFXNotificationPost_block_invoke_0 
+ 70' 
CoreFoundation:7:in `0x37ca20cf _CFXNotificationPost + 1406' 
Foundation:8:in `0x31be33fb -[NSNotificationCenter 
postNotificationName:object:userInfo:] + 66' 
Foundation:9:in `0x31be4c2b -[NSNotificationCenter 
postNotificationName:object:] + 30' 
MyApp:10:in `0x000d2157 -[RKObjectLoader isResponseMappable] + 114' 
MyApp:11:in `0x000d2b83 -[RKObjectLoader didFinishLoad:] + 418' 
MyApp:12:in `0x000cb151 -[RKResponse connectionDidFinishLoading:] + 
36' 
Foundation:13:in `0x31ca6c39 __65-[NSURLConnectionInternal 
_withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 16' 
Foundation:14:in `0x31bfe6e9 -[NSURLConnectionInternalConnection 
invokeForDelegate:] + 28' 

If anyone has any helpful tips, ideas, or suggestions on how to debug this, it would be greatly appreciated! I've been dealing with this for two weeks and am only seeing it in deployed apps (cannot replicate the issue) so any insight is better than none! Cheers!

Was it helpful?

Solution 2

Just incase any others fall onto this solution, the approach I took was:

Completely remove RestKit from my existing project. I then downloaded the master branch of RestKit, reintegrated into my project (there were some deprecated methods, less necessary frameworks, and refactored classes, but all in all pretty simple). I will be releasing this version with the new RestKit within the next week or so, and HOPE to not see this issue arising again.:)

If I do have this issue, I will come back and modify my answer with a reason for why it's still happening.

OTHER TIPS

Check whether you have add all the frame works recommended for RestKit, in your project

1. **CFNetwork.framework**
1. **CoreData.framework**
1. **MobileCoreServices.framework**
1. **SystemConfiguration.framework**
1. **libxml2.dylib**
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top