2
我有一個問題,我的Facebook應用程序的斷開是一個簡單的應用程序,上傳一張照片到Facebook。 要登錄,您需要註銷safari,但不能完全註銷並在我的帳戶中執行下一次登錄。我在php中看到了幾個選項,但沒有工作。附帶代碼註銷Facebook的sdk 3.08
- (void)viewDidLoad
{
[buttonPost setHidden:NO];
FBLoginView *loginview = [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"publish_actions"]];
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
loginview.delegate = self;
[self.view addSubview:loginview];
[loginview sizeToFit];
}
- (IBAction)Post:(UIButton *)sender{
[FBRequestConnection startForUploadPhoto:self.imageScreen completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
[self showAlert:@"Photo Post" result:result error:error];
}];
}
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
[self.buttonPost setHidden:YES];
self.labelFirstName.text = nil;
}
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
// first get the buttons set for login mode
[self.buttonPost setHidden:NO];
}
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
// here we use helper properties of FBGraphUser to dot-through to first_name and
// id properties of the json response from the server; alternatively we could use
// NSDictionary methods such as objectForKey to get values from the my json object
self.labelFirstName.text = [NSString stringWithFormat:@"Hello %@!", user.first_name];
// setting the profileID property of the FBProfilePictureView instance
// causes the control to fetch and display the profile picture for the user
self.loggedInUser = user;
}
- (void)showAlert:(NSString *)message
result:(id)result
error:(NSError *)error {
NSString *alertMsg;
NSString *alertTitle;
if (error) {
alertMsg = error.localizedDescription;
alertTitle = @"Error";
} else {
NSDictionary *resultDict = (NSDictionary *)result;
alertMsg = [NSString stringWithFormat:@"Successfully posted",
message, [resultDict valueForKey:@"id"]];
alertTitle = @"Success";
}
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertTitle
message:alertMsg
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}