PFLogInViewController错误-使用Parse注销后无法登录到Facebook [英] PFLogInViewController error- unable to login to Facebook after logging out with Parse
问题描述
我正在使用PFLogInViewController登录到首次成功运行的Facebook-
I am using PFLogInViewController to login to facebook which works successfully the first time-
- (void)logInViewController:(PFLogInViewController *)controller
didLogInUser:(PFUser *)user {
if([PFFacebookUtils isLinkedWithUser:user]){
FBRequest *request = [FBRequest requestForMe];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSDictionary *userData = (NSDictionary *)result;
NSString *facebookID = userData[@"id"];
NSString *name = userData[@"name"];
NSString *location = userData[@"location"][@"name"];
NSString *gender = userData[@"gender"];
NSString *birthday = userData[@"birthday"];
NSString *relationship = userData[@"relationship_status"];
[user setObject:userData[@"id"] forKey:@"fbId"];
[user setObject:userData[@"name"] forKey:@"name"];
[user setObject:userData[@"email"] forKey:@"email"];
[user saveInBackground];
NSURL *pictureURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=large&return_ssl_resources=1", facebookID]];
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
PFFile *profileImage=[PFFile fileWithData:data];
[user setObject:profileImage forKey:@"profileImage"];
[user saveInBackground];
}
}];
}];
}
[self dismissViewControllerAnimated:YES completion:nil];
}
如果我随后调用[PFUser logOut]并再次打开PFLogInViewController,则当我点击Facebook图标再次登录时,facebook微调框将无限期旋转,并且出现错误尝试将objectId更改为已知的离线商店".
If I then call [PFUser logOut] and open the PFLogInViewController again, when I tap the facebook icon to log in again, the facebook spinner spins indefinitely and I get the error "Attempted to change an objectId to one that's already known to the OfflineStore."
如何注销当前用户,然后使用PFLogInViewController重新登录?
How do I log out of the current user and then login again using PFLogInViewController?
推荐答案
如果我从appDelegate中删除了[Parse enableLocalDatastore]
,则不会再出现此错误.如果我不固定任何对象,禁用此功能是否有不利之处?如果没有网络连接,我还能使用"saveEventually"吗?
If I remove [Parse enableLocalDatastore]
from the appDelegate, I no longer get this error. If I am not pinning any objects is there any disadvantage to disabling this? Will I still be able to use "saveEventually" if there is no network connection?
这篇关于PFLogInViewController错误-使用Parse注销后无法登录到Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!