6

kullanarak Facebook kullanıcı bilgilerini alma, ama bu NULL alıyorum firstMatch aşağıdaki koduBen Facebook'tan temel kullanıcı bilgi almak istiyorum grafik API

-(void)checkForAccessToken:(NSString *)urlString { 
    NSError *error; 
    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"access_token=(.*)&" options:0 error:&error]; 
    if (regex != nil) { 
     **NSTextCheckingResult *firstMatch = [regex firstMatchInString:urlString options:0 range:NSMakeRange(0, [urlString length])]; 
     if (firstMatch) { 
      NSRange accessTokenRange = [firstMatch rangeAtIndex:1]; 
      NSString *accessToken = [urlString substringWithRange:accessTokenRange]; 
      accessToken = [accessToken stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 
      [_delegate accessTokenFound:accessToken];    
     }** 
    } 
} 

bazı sorunu yaşıyor neden [_delegate accessTokenFound: accessToken ]; Bu yöntemler aranmaz. Önceden teşekkür

Facebook

kullanıcı bilgilerine mümkün olacaktır böylece

kimse bana yardım edebilir.

+0

facebook sdk kullanıyorsunuz credentials.- uygulama kimliği ve onu initialising sonra fbdid giriş yöntemi? Resmi Graph API'sini kullanmak yerine neden bu şekilde erişim belirteci almak istersiniz? – vinzenzweber

+0

Genellikle sadece Facebook dev kılavuzlarında önerildiği gibi yapmanız gerekir: https://developers.facebook.com/docs/mobile/ios/build/#graph – vinzenzweber

cevap

3

Çağrı

(void)fbDidLogin { 

NSLog(@"fbDidLogin"); 
isFacebookLoaded=YES; 


NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"]; 
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"]; 
[defaults synchronize]; 
NSLog(@"i am in and my acees token is %@ %@ and call me.CALLshowAloadingView",[facebook accessToken],[facebook expirationDate]) ; 
[self.facebook requestWithGraphPath:@"me" andDelegate:self]; 
if ([delegate respondsToSelector:@selector(showAloadingView)]) 
{ 
    NSLog(@" CALLshowAloadingView"); 
    // calling delegate method. For this method to function, the delegate should be implemented in the calling class. 
    [delegate showAloadingView];     
} 


// Inform the delegate that Login is successful 
if ([delegate respondsToSelector:@selector(loginStatus:)]) { 
    // calling delegate method. For this method to function, the delegate should be implemented in the calling class. 
    [delegate loginStatus:YES];     
    return; 
} 

}

İlgili konular