Ios 如何在设置中编辑facebook的权限
我尝试了这个方法来获取Facebook(登录用户)的个人信息,但它需要权限,因为我不知道在哪里添加权限,我已经检查了设置,在模拟器中尝试了所有东西,但仍然无法获取Ios 如何在设置中编辑facebook的权限,ios,facebook,Ios,Facebook,我尝试了这个方法来获取Facebook(登录用户)的个人信息,但它需要权限,因为我不知道在哪里添加权限,我已经检查了设置,在模拟器中尝试了所有东西,但仍然无法获取 转到设置应用程序并检查其上列出的Facebook,单击该应用程序并检查所有权限。我只提供了两个权限日历和联系人。还有一个Facebook选项,请打开该选项。检查编辑我已上载权限图片 - (void)viewDidLoad { [super viewDidLoad]; if (NO == [SLComposeV
转到设置应用程序并检查其上列出的Facebook,单击该应用程序并检查所有权限。我只提供了两个权限日历和联系人。还有一个Facebook选项,请打开该选项。检查编辑我已上载权限图片
- (void)viewDidLoad {
[super viewDidLoad];
if (NO == [SLComposeViewController isAvailableForServiceType: SLServiceTypeFacebook]) {
[self showAlert:@"There are no Facebook accounts configured. Please add or create a Facebook account in Settings."];
return;
}
[self getMyDetails];
// Do any additional setup after loading the view from its nib.
}
- (void) getMyDetails {
if (! accountStore) {
accountStore = [[ACAccountStore alloc] init];
}
if (! facebookAccountType) {
facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
}
NSDictionary *options = @{ ACFacebookAppIdKey: [NSString stringWithFormat:@"1725978560966525"] };
[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 *responseDictionary = [NSJSONSerialization JSONObjectWithData:responseData
options:NSJSONReadingMutableContainers
error:nil];
NSLog(@"id: %@", responseDictionary[@"id"]);
NSLog(@"first_name: %@", responseDictionary[@"first_name"]);
NSLog(@"last_name: %@", responseDictionary[@"last_name"]);
NSLog(@"gender: %@", responseDictionary[@"gender"]);
NSLog(@"city: %@", responseDictionary[@"location"][@"name"]);
}];
} else {
[self showAlert:@"Facebook access for this app has been denied. Please edit Facebook permissions in Settings."];
}
}];
}
- (void) showAlert:(NSString*) msg {
dispatch_async(dispatch_get_main_queue(), ^(void) {
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"WARNING"
message:msg
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
});
}