FBRequest requestForMe startWithCompletionHandler方法在设备上无法工作 [英] FBRequest requestForMe startWithCompletionHandler method not working on device
问题描述
- (void)populateUserDetails {
if(FBSession.activeSession.isOpen){
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection * connection,NSDictionary< FBGraphUser> * user,NSError * error){
if(!error){
NSLog在);
} else {
NSLog(@error:%@,error);
}
}];
} else {
NSLog(@no active session);
}
}
使用断点,我确定activeSession始终打开,所以startWithCompletionHandler:方法实际上被调用。也许这是一个构建问题,因为它在模拟器上运行良好?任何想法?
回答我自己的问题:转到您的Facebook应用页面,确保0自动插入您的App Store ID。我已经将我的软件包ID设置为正确的值(您也必须这样做),但是一夜之间,Facebook自动将App Store ID值设置为0.一旦我删除了该值,一切都会工作。
I have followed all the directions from the Facebook Developer website about integrating Facebook SDK 3.1 into iOS 6. My code runs perfectly on the iPhone 6.0 Simulator (user can log into Facebook), but when I run the app on my iPhone, the function [FBRequest requestForMe] startWithCompletionHandler] doesn't generate a response. According to the Facebook Developer website, it should either be successful or return an error, but it does neither. The app just sits there waiting for a response that never comes. My code is below:
- (void)populateUserDetails {
if (FBSession.activeSession.isOpen) {
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
if (!error) {
NSLog(@"logged in");
} else {
NSLog(@"error: %@", error);
}
}];
} else {
NSLog(@"no active session");
}
}
Using breakpoints, I determined that the activeSession is always open, so the startWithCompletionHandler: method is actually called. Maybe it's a build problem since it runs fine on the Simulator? Any ideas?
Answered my own question: go to your Facebook app page and make sure that a "0" value hasn't been inserted automatically for your App Store ID. I had already set my bundle ID to the correct value (which you also have to do), but overnight, Facebook automatically set the App Store ID value to 0. Everything worked as soon as I removed that value.
这篇关于FBRequest requestForMe startWithCompletionHandler方法在设备上无法工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!