Getting “Error Code 8” When Calling [ACAccountStore requestAccessToAccountsWithType] - iOS Facebook

你说的曾经没有我的故事 提交于 2019-12-01 06:49:38

There is an error in your options dictionary.

NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:
                     (NSString *)ACFacebookAppIdKey, @"###############",  
                     (NSString *)ACFacebookPermissionsKey, [NSArray arrayWithObject:@"email"],  
                     nil];

read better the method declaration: "dictionary with object and keys", so first object, then key...but you have inserted first KEYS and then OBJECTS (wrong order :-)

The correct dictionary is:

    NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:
                         @"###############", ACFacebookAppIdKey, 
                         [NSArray arrayWithObject:@"email"], ACFacebookPermissionsKey, 
                         nil];

or, declaring dictionary literal:

    NSDictionary *options = @{
                              ACFacebookAppIdKey : @"###############",
                              ACFacebookPermissionsKey : [NSArray arrayWithObject:@"email"]
                             };
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!