NSMutableDictionaryのカテゴリを持つObjective-Cで書かれたアプリがあります。 iOS9では、アプリは正常に動作します。しかし、iOS10で実行すると、アプリケーションが「インスタンスに送信されたセレクタが認識されない」ためクラッシュします。私は、NSMutableDictionaryカテゴリをiOS10で尊重しないように問題を切り分けました。NSMutableDictionaryのObjective-CカテゴリがiOS10で尊重されていない
- (id)getObjectForStringKeyPath:(NSString *)keysPath {
NSArray *dividedString = [keysPath componentsSeparatedByString:@"/"];
return [self getObjectForKeyPath:dividedString];
}
それがある時にクラッシュしているライン(レスポンスが 'ID' を入力している):
NSArray *textArray = [response getObjectForStringKeyPath:"someText/text"];
私は応答をチェックしました
NSMutableDictionaryのカテゴリは、以下の方法を含み、サーバーから応答が有効です。また、私が言ったように、クラッシュはiOS9では起こりません。 iOS10でのみ発生します。
これを解決する方法、またはこの問題を解決する方法を知っている人はいますか?
クラッシュログ
-[__NSSingleEntryDictionaryI getObjectForStringKeyPath:]: unrecognized selector sent to instance 0x608000a3f3e0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSSingleEntryDictionaryI getObjectForStringKeyPath:]: unrecognized selector sent to instance 0x608000a3f3e0'
*** First throw call stack:
(
0 CoreFoundation 0x000000011036034b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010fdc121e objc_exception_throw + 48
2 CoreFoundation 0x00000001103cff34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001102e5c15 ___forwarding___ + 1013
4 CoreFoundation 0x00000001102e5798 _CF_forwarding_prep_0 + 120
5 XYZApp 0x000000010c919b7e __64-[XYZController configureConditionsTextFromHTML:]_block_invoke + 126
6 XYZApp 0x000000010c8e973f __41-[XYZDataProvider getTermsAndConditions:]_block_invoke + 159
7 XYZApp 0x000000010c8fd5ae -[XYZManager handleSuccessfulResponse:andResponseBlock:] + 110
8 XYZApp 0x000000010c8fbede __50-[XYZManager GET:withParameters:andResponseBlock:]_block_invoke + 126
9 libdispatch.dylib 0x0000000110872980 _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x000000011089c0cd _dispatch_client_callout + 8
11 libdispatch.dylib 0x000000011087ca1d _dispatch_main_queue_callback_4CF + 733
12 CoreFoundation 0x00000001103244f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
13 CoreFoundation 0x00000001102e9f8d __CFRunLoopRun + 2205
14 CoreFoundation 0x00000001102e9494 CFRunLoopRunSpecific + 420
15 GraphicsServices 0x00000001131c9a6f GSEventRunModal + 161
16 UIKit 0x000000010e573f34 UIApplicationMain + 159
17 XYZApp 0x000000010c92698f main + 111
18 libdyld.dylib 0x00000001108e868d start + 1
19 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
質問にすべてのメッセージを貼り付けることはできますか?時には、インスタンスのタイプとアドレスが報告するものは、手がかりを提供します。 –
'id'を' NSMutableDictionary'にキャストします。 – rmaddy
上記のiOS 10に問題はありません。正常に動作します。このカテゴリが作成しているターゲットに含まれていることを確認してください。そうでない場合は、完全なエラーメッセージを含めるように質問を編集してください。 – Rob