i trying bring obj-c code swift (facebook ios sdk), autocomplete(intellisense) not work in handler , error (marked in code) : set nsobject not have member named 'containsobject'
@ibaction func loginwithfacebook(sender: anyobject) { /* fbsdkloginmanager *login = [[fbsdkloginmanager alloc] init]; [login loginwithreadpermissions:@[@"email"] handler:^(fbsdkloginmanagerloginresult *result, nserror *error) { if (error) { // process error } else if (result.iscancelled) { // handle cancellations } else { // if ask multiple permissions @ once, // should check if specific permissions missing if ([result.grantedpermissions containsobject:@"email"]) { // work } } }]; */ let fbloginmanager = fbsdkloginmanager() fbloginmanager.loginwithreadpermissions(["email"], handler: { result, error in if ((error) != nil){ } else if (result.iscancelled){ } else { if(result.grantedpermissions.containsobject("email")){ //<-- error here } } }) }
because swift 1.2 automatically casts nsset objects (the ones coming external libs/sdks/frameworks etc...) set structure need call contains instead of containsobject such things (doc).
Comments
Post a Comment