if you are getting error 256 in iOS/iPhone.
Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x218446a0
This error coming due to your page is not in "Standards compliance mode", it may be in "Quirks mode".
To know the mode, open the webpage in firefox, click right mouse and open "View page Info".
If you want to open the url in non "Standards compliance mode" try this code =>
Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x218446a0
This error coming due to your page is not in "Standards compliance mode", it may be in "Quirks mode".
To know the mode, open the webpage in firefox, click right mouse and open "View page Info".
If you want to open the url in non "Standards compliance mode" try this code =>
NSString *str = [NSString stringWithFormat:@"https://graph.facebook.com/me?access_token=CAADbwxRRgq8BANULcGGn3d4NPZB4LlP3tCL9YjYH3Nd0fD2XvgjG0qTECEmOsFhNhcu4NCdgYzQK3lYaATiedLRP4ZAIRgf8FBtDBYd22z5BrMabHlex12nZAbm8UfJTrPVRw5rjN8abi9"]; NSURL* url = [NSURL URLWithString:[str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSError* error = nil; NSData* data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30] returningResponse:nil error:&error]; NSString *jsonStr = [NSString stringWithUTF8String:[data bytes]]; NSMutableDictionary *dictFromServer = [NSJSONSerialization JSONObjectWithData:urlData options:kNilOptions error:&error] if (error) { NSLog(@"%@", [error localizedDescription]); } else { NSLog(@"Data has loaded successfully.%@, in dict %@",jsonStr, dictFromServer); }
No comments:
Post a Comment