을 사용하는 iOS 앱이 있습니다. Facebook 사용자 로그인을 통해 정보를 얻을 수 있습니다. 내가 (아이폰 OS 시뮬레이터) 새 사용자로이 작업을 수행 할 때com.facebook.sdk 오류 2 iOS 앱에 Parach
- (IBAction)toQuadAction:(id)sender {
// Query to fetch the users name and picture
NSString *query = @"SELECT name, username FROM user WHERE uid=me() ";
// Set up the query parameter
NSDictionary *queryParam = [NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];
// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql" parameters:queryParam HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"My name: %@", result[@"data"][0][@"name"]);
NSLog(@"My username: %@", result[@"data"][0][@"username"]);
//SAVE TO CORE DATA
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSEntityDescription *user = [NSEntityDescription entityForName:@"User" inManagedObjectContext:appDelegate.managedObjectContext];
NSFetchRequest *getName = [[NSFetchRequest alloc] init];
[getName setReturnsObjectsAsFaults:NO];
[getName setEntity:user];
NSError *error;
NSMutableArray *currentUser = [[appDelegate.managedObjectContext executeFetchRequest:getName error:&error] mutableCopy];
//SAVE THE NAME TO CORE DATA
[currentUser[0] setName:result[@"data"][0][@"name"]];
//SAVE NAME AND PICTURE TO PARSE
PFQuery *query = [PFQuery queryWithClassName:@"Student"];
[query whereKey:@"email" equalTo:[currentUser[0] valueForKey:@"email"]];
[query getFirstObjectInBackgroundWithBlock:^(PFObject *users, NSError *error) {
if (!users){
NSLog(@"The first object request failed");
} else{
NSLog(@"grabbed the object");
//SET THE NAME IN PARSE
[users setObject:result[@"data"][0][@"name"] forKey:@"name"];
//SET THE IMAGE IN PARSE
NSString *URLString = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?width=235&height=385", result[@"data"][0][@"username"]];
NSURL *picURL = [NSURL URLWithString:URLString];
NSData *picData = [NSData dataWithContentsOfURL:picURL];
PFFile *picture = [PFFile fileWithData:picData ];
[users setObject:picture forKey:@"picture"];
[users saveInBackground];
}
}];
}
[self performSegueWithIdentifier:@"facebookToQuad" sender:sender];
}];
}
이미되지 않은 : 나는 사용자가 "페이스 북으로 로그인"읽기 버튼을 누르면 그 아래의 코드가 발생 포함 시켰습니다 Facebook에 내 앱이 허용되면 "작업을 완료 할 수 없습니다 (com.facebook.sdk 오류 2)"라는 경고가 나타납니다.
이 질문을 전에 보았지만 나에게 맞는 해결책을 찾지 못했습니다. 하나는 필자가 PhoneGap 같은 것을 사용하지 않고 네이티브를 구축하는 것입니다. 또 다른 것은 내 인터넷 연결 상태가 좋을 것 같습니다. 나는 다른 일을하는 데 문제가 없습니다.
누구든지이 문제에 대한 해결책을 알고 있습니까? 감사합니다.
fb id에서 샌드 박스가 비활성화되어 있는지 확인하십시오. –
모든 앱 URL 콜백 설정이 구성되어 있습니까? – Wain
당신은 그것을 @ 파서, 고마워. 내가 그것을 받아 들일 수 있도록 질문을 올려라. –