0
這是全部使用Parse 1.8.2框架有沒有解析允許Facebook登錄的方法?
在我的應用程序更新爲iOS 9的工作,並遇到了解析框架,特別是與Facebook登錄問題。嘗試當我寫着登錄失敗com.facebook.sdk錯誤5.在控制檯登錄的彈出我得到:
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-14 23:19:59.036 iPrayed[2649:125172] Failed to log in...Error Domain=com.facebook.sdk Code=5 "(null)" UserInfo={com.facebook.sdk:ErrorInnerErrorKey=Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x7fc622827810>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?,
我處理與登錄Facebook的:
FBRequest *request = [FBRequest requestForMe];
// Send request to Facebook
[request startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *userCloud, NSError *error) {
if (!error) {
// result is a dictionary with the user's Facebook data
NSDictionary *userData = userCloud;
NSLog(@"%@", userData);
NSString *facebookID = userData[@"id"];
PFUser *me = [PFUser currentUser];
NSString *objective = [me objectId];
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation setValue:objective forKey:@"usersObjectId"];
me[@"fbId"] = facebookID;
[currentInstallation saveInBackground];
me[@"additional"] = userCloud.name;
// me[@"lastName"] = userCloud.last_name;
me[@"email"] = userData[@"email"];
UIImage *theImage = [[FBSingleton sharedInstance] userImage];
[me saveEventually];
// download the image from Facebook and then save it into the singleton
NSURL *pictureURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=normal&return_ssl_resources=1", facebookID]];
NSLog(@"Picture URL%@", pictureURL);
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:pictureURL];
// Run network request asynchronously
[NSURLConnection sendAsynchronousRequest:urlRequest
queue:[NSOperationQueue mainQueue]
completionHandler:
^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (connectionError == nil && data != nil) {
// Set the image in the header imageView
// self.headerImageView.image = [UIImage imageWithData:data];
UIImage *image = [UIImage imageWithData:data];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Image.png"];
[UIImagePNGRepresentation(image) writeToFile:filePath atomically:YES];
NSUserDefaults *testDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.316apps.iPrayed"];
[testDefaults setObject:me.username forKey:@"username"];
[testDefaults setObject:me.password forKey:@"password"];
[testDefaults synchronize];
FBSingleton *sharedSingleton = [FBSingleton sharedInstance];
sharedSingleton.userImage = image;
}
}];
}
}];
什麼回事這個?