RestKit ObjectLoader 无法识别的选择器尝试映射对象
此问题特定于 RestKit,但我认为根本问题与注册通知有关。我真的需要一些帮助来解决这个问题...我似乎多次出现相同的问题:
来自 NSInvalidArguementException
serviceDidBecomeUnavailableNotification
在 RKClient
内。行动 正在从 __NSMallocBlock__
、__NSCFString
、__NSCFArray
、NSURL
调用, 和UICFFont
...显然委托设置不正确。
仅在我的请求中使用 RKObjectMapping
将响应映射到 我的模型课程。我注意到 objectLoader
有 isResponseMappable
并检查 [self.response isServiceUnavailable]
- 然后发布一个RKServiceDidBecomeUnavailableNotification
。这 似乎是我的问题的来源。我唯一看到的地方 isResponseMappable
被调用是在 didFinishLoad:(RKResponse*)response
内。
这是一个示例堆栈跟踪,我认为这可能非常有益:
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'
如果任何人对如何调试它有任何有用的提示、想法或建议,我们将非常表示赞赏!我已经处理这个问题两周了,并且仅在已部署的应用程序中看到它(无法复制该问题),因此任何见解都比没有好!干杯!
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 fromserviceDidBecomeUnavailableNotification
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
hasisResponseMappable
and checks [self.response isServiceUnavailable]
-
which then posts a RKServiceDidBecomeUnavailableNotification
. This
seems to be where my issue is coming from. The only place I seeisResponseMappable
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查你的项目中是否添加了RestKit推荐的所有框架
Check whether you have add all the frame works recommended for RestKit, in your project
为了防止其他人陷入这个解决方案,我采取的方法是:
从我现有的项目中完全删除
RestKit
。然后我下载了 RestKit 的 master 分支,重新集成到我的项目中(有一些已弃用的方法、不太必要的框架和重构的类,但总而言之非常简单)。我将在下周左右发布带有新 RestKit 的此版本,希望不会再出现此问题。:)如果我确实遇到此问题,我会回来修改我的回答为什么它仍然发生。
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.