1
페이스 북 기능으로 로그인을 사용하고 있으며 페이스 북에서 이메일 주소를 얻습니다. 여기 내 코드가있다. "라고 invalidationHandler LaunchServices"여기 SLComposeViewController (다른 부분)에서 페이스 북에서 로그인하지 않을 때 SLComposeViewController가 존재하지 않습니다.
if (! _accountStore) {
_accountStore = [[ACAccountStore alloc] init];
}
if (! _facebookAccountType) {
_facebookAccountType = [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
}
NSDictionary *options = @{ ACFacebookAppIdKey:@"1501842240102594" };
[_accountStore requestAccessToAccountsWithType: _facebookAccountType
options: options
completion: ^(BOOL granted, NSError *error) {
if (granted) {
NSArray *accounts = [_accountStore accountsWithAccountType:_facebookAccountType];
_facebookAccount = [accounts lastObject];
NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me"];
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:url parameters:nil];
request.account = _facebookAccount;
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSDictionary *dictionaryForFacebookData = [NSJSONSerialization JSONObjectWithData:responseData
options:NSJSONReadingMutableContainers
error:nil];
//Here dictionaryForFacebookData is dictionary of facebook data.
}
else
{
SLComposeViewController *tweetSheet = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
[tweetSheet setInitialText:@"Great fun to learn iOS programming at appcoda.com!"];
[self presentViewController:tweetSheet animated:YES completion:nil];
if ([tweetSheet respondsToSelector:@selector(popoverPresentationController)])
{
// iOS 8+
UIPopoverPresentationController *presentationController = [tweetSheet popoverPresentationController];
presentationController.sourceView = sender; // if button or change to self.view.
}
}
}];
}
, 그것은
이 일부 오류를 보여줍니다. iOS 8 이전에는 SLComposeViewController를 사용하여 설정 부분에 로그인 Facebook에 사용자를 표시했습니다. 도와주세요.