I have a Parse.com login that has our design on it. Along with a Facebook button to sign in and register.
The sign up and sign in works fine on the simulator, but I have just put it on an iPhone 5s and when the button is clicked, it ask's weather you want the app to access your information, then after clicking yes it just goes back to the log in screen. I looked at the NSlog and its saying failed to log in.
But as I see on the simulator it seems to work fine.
.m File:
- (void)viewDidAppear:(BOOL)animated
{
[PFFacebookUtils initializeFacebook];
[PFTwitterUtils initializeWithConsumerKey:@"HIDDEN"
consumerSecret:@"HIDDEN"];
// Check if user is logged in
if (![PFUser currentUser]) {
// Instantiate our custom log in view controller
MyLogInViewController *logInViewController = [[MyLogInViewController alloc] init];
[logInViewController setDelegate:self];
[logInViewController setFacebookPermissions:[NSArray arrayWithObjects:@"friends_about_me", nil]];
[logInViewController setFields:PFLogInFieldsUsernameAndPassword
//| PFLogInFieldsTwitter
| PFLogInFieldsFacebook
| PFLogInFieldsSignUpButton
| PFLogInFieldsDismissButton];
// Instantiate our custom sign up view controller
MySignUpViewController *signUpViewController = [[MySignUpViewController alloc] init];
[signUpViewController setDelegate:self];
[signUpViewController setFields:PFSignUpFieldsDefault | PFSignUpFieldsAdditional];
// Link the sign up view controller
[logInViewController setSignUpController:signUpViewController];
// Present log in view controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
[super viewDidAppear:animated];
self.canDisplayBannerAds = YES;
}
// Sent to the delegate when a PFUser is logged in.
- (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user {
[self dismissViewControllerAnimated:YES completion:NULL];
}
// Sent to the delegate to determine whether the log in request should be submitted to the server.
- (BOOL)logInViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password {
// Check if both fields are completed
if (username && password && username.length != 0 && password.length != 0) {
return YES; // Begin login process
}
[[[UIAlertView alloc] initWithTitle:@"Missing Information"
message:@"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:@"ok"
otherButtonTitles:nil] show];
return NO; // Interrupt login process
}
// Sent to the delegate when the log in attempt fails.
- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error {
NSLog(@"Failed to log in...");
}
// Sent to the delegate when the log in screen is dismissed.
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController {
[self dismissViewControllerAnimated:NO completion:nil];
//[self.navigationController popViewControllerAnimated:YES];
[[[UIAlertView alloc] initWithTitle:@"Log In Required"
message:@"Please Make Sure You Log In, Or Sign Up As A New User!"
delegate:nil
cancelButtonTitle:@"ok"
otherButtonTitles:nil] show];
}
// Sent to the delegate when a PFUser is signed up.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didSignUpUser:(PFUser *)user {
[self dismissViewControllerAnimated:YES completion:nil]; // Dismiss the PFSignUpViewController
}
// Sent to the delegate when the sign up attempt fails.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error {
NSLog(@"Failed to sign up...");
}
// Sent to the delegate when the sign up screen is dismissed.
- (void)signUpViewControllerDidCancelSignUp:(PFSignUpViewController *)signUpController {
NSLog(@"User dismissed the signUpViewController");
}
I only have one more iPhone but it has iOS 8 on it, so I can't try it on that one.
2014-07-23 14:53:30.528 WeddingsAndMore[985:60b] {
NSLocalizedFailureReason = "com.facebook.sdk:SystemLoginCancelled";
"com.facebook.sdk:ErrorInnerErrorKey" = "Error Domain=com.apple.accounts Code=7 \"The Facebook server could not fulfill this access request: Invalid permission: friends_about_me\" UserInfo=0x17026b700 {NSLocalizedDescription=The Facebook server could not fulfill this access request: Invalid permission: friends_about_me}";
"com.facebook.sdk:ErrorLoginFailedReason" = "com.facebook.sdk:SystemLoginCancelled";
"com.facebook.sdk:ErrorSessionKey" = "<FBSession: 0x17813cca0, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: 52610783371, urlSchemeSuffix: , tokenCachingStrategy:<PFFacebookTokenCachingStrategy: 0x1780319e0>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>";
}
i have removed the friends_about_me now im getting the following
NSLocalizedFailureReason = "com.facebook.sdk:SystemLoginError";
"com.facebook.sdk:ErrorInnerErrorKey" = "Error Domain=com.apple.accounts Code=7 \"The Facebook server could not fulfill this access request: Invalid application <redacted>\" UserInfo=0x170273040 {NSLocalizedDescription=The Facebook server could not fulfill this access request: Invalid application <redacted>}";
"com.facebook.sdk:ErrorLoginFailedReason" = "com.facebook.sdk:SystemLoginError";
"com.facebook.sdk:ErrorSessionKey" = "<FBSession: 0x178125c80, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: <redacted>, urlSchemeSuffix: , tokenCachingStrategy:<PFFacebookTokenCachingStrategy: 0x17003de60>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>";
}
Seems to be i get rid of one error i get another.
there was spaces in the app name in the plist i got rid of the spaces and now i get the following errors
NSLocalizedFailureReason = "com.facebook.sdk:SystemLoginCancelled";
"com.facebook.sdk:ErrorInnerErrorKey" = "Error Domain=com.apple.accounts Code=7 \"The Facebook server could not fulfill this access request: An unknown error occurred\" UserInfo=0x17027c8c0 {NSLocalizedDescription=The Facebook server could not fulfill this access request: An unknown error occurred}";
"com.facebook.sdk:ErrorLoginFailedReason" = "com.facebook.sdk:SystemLoginCancelled";
"com.facebook.sdk:ErrorSessionKey" = "<FBSession: 0x1781366c0, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: 6565656656565, urlSchemeSuffix: , tokenCachingStrategy:<PFFacebookTokenCachingStrategy: 0x17003a700>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>";