NSMutableUrlリクエストを使用して.net WebサーバーからWebデータを取得しています。NSInvalidArgumentException '、[理由:' - [__ NSPlaceholderDictionary initWithObjects:forKeys:エラー
NSXmlparsingを使用して応答を解析してNSDirectoryに格納すると、SOAPリクエストを使用してデータを取得しています。
私のコードは、それが正常に動作しますが、これまで私が間違って入力した場合ときには、このような例外を取得し
NSArray *keys = [NSArray arrayWithObjects:@"id", @"firstname", @"lastname",@"addr",@"state",@"country",@"email",@"phone", nil];
directory = [NSDictionary dictionaryWithObjects:resultData forKeys:keys];
[[NSUserDefaults standardUserDefaults] setObject:directory forKey:@"dictionaryKey"];
です。
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (0) not equal to number of keys (8)'
は、私はこの
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GenericAndroidMethodResponse xmlns="Mortgage"><GenericAndroidMethodResult><NewDataSet /></GenericAndroidMethodResult></GenericAndroidMethodResponse></soap:Body></soap:Envelope>
のように、Webサーバからの応答を取得していますし、アプリケーションが終了します。
しかし、私が間違った応答を得た場合、その時点で私は警告を表示する必要がありますが、アプリケーションから終了する必要はありません。
どうすればいいですか?
私の質問ははっきりしていると思います。
いずれかのplsが私を助けることができます。
ありがとうございます。