
var completionHandler: FBSessionStateHandler = { session,status,error in NSLog("token not cached"); if error { // Login Failed for some reason,so we notify the delegate. self.delegate.dIDFailOpenningSession?(self,withError: ErrorUtility.error( code: .FailedOpenningSession,withFacebookError: error )); // Don't proceed on errors return; } // Session is Now open,we should notify the delegate self.delegate.dIDOpenSession?(self); }; NSLog("here"); // Open the session,prompting the user if necessary. This might send the application to the background if FBSession.openActiveSessionWithReadPermissions(["public_profile"],allowLoginUI: true,completionHandler: completionHandler) { NSLog("Token cached"); // If we end up here,the session token must exist,so we Now have an open session self.delegate.dIDOpenSession?(self); } 编辑:我忘了提到NSLog记录“这里”,但不是“令牌缓存”或“令牌没有缓存”
编辑:现在事情有点奇怪了.当我的应用程序启动时,我会显示一个带有Facebook登录按钮的屏幕.当用户按下按钮时,上面的代码被触发.在我授权应用程序之后,应用程序返回到同一个屏幕(它不应该,但是在调用完成处理程序之前我不能以任何其他方式执行).然后我再次尝试按下按钮,现在我确实得到了日志.
这就是我得到的:
here token not cached here
第一行是从第一次按下按钮,另外两行是在我第二次按下时出现的.现在有什么奇怪的呢?不应该“令牌没有缓存”和“这里”被逆转???它是从最后一次通话中调用competionHandler还是其他什么东西?
没关系,这很多都是固定的.
编辑:另一件事.如果我多次按下按钮,我总是得到“令牌未缓存”.我认为它应该是缓存
解决方法 它已经解决了.我错过了方法AppDelegate.application:handleOpenURL – >布尔 总结以上是内存溢出为你收集整理的ios – FBSession.openActiveSessionWithReadPermissions未调用completionHandler全部内容,希望文章能够帮你解决ios – FBSession.openActiveSessionWithReadPermissions未调用completionHandler所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)