2016-06-18 11 views
0
NSData *jsonDataEncrypted = [jsonStringEncrypted dataUsingEncoding:NSUTF8StringEncoding]; 
NSDictionary *jsonDicEncrypted = [NSJSONSerialization JSONObjectWithData:jsonDataEncrypted options:kNilOptions error:nil]; 

上記のコードは動作しません。暗号化されたNSDataをNSDictionaryに変換するにはどうすればよいですか?

がnull jsonDicEncrypted。

+3

は申し訳ありませんが、エラー – vadian

+0

の種類を把握するために、 'ERROR'パラメータを使用し、私は –

+0

エラーが「JSONテキストが設定されていない断片を許可するように配列またはオブジェクトとオプションで起動しませんでした」であることを忘れてしまいました。私は次に何をすべきですか? NSDataは暗号化されています。 –

答えて

-1
NSData *data = [NSURLConnection sendSynchronousRequest:req returningResponse:nil error:&err]; 
    NSDictionary *jsons=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; 

このコードを使用

-1

これをチェックしてください。

[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *connectionError) { 
      NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:nil]; 
      dispatch_async(dispatch_get_main_queue(), ^{ 
       //UI update here 
      }); 
      }]; 
関連する問題