当应用切换到Facebook进行登录和许可请求时,防止IOS关闭应用程序 [英] Prevent IOS to shutdown an app when it app switch to facebook for login and permission request

查看:154
本文介绍了当应用切换到Facebook进行登录和许可请求时,防止IOS关闭应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的坚持这个问题,我需要你的帮助!
我正在做一个统一的ipad游戏和来自prime31的社交网络插件。



情况:



当你到达水平的最后,游戏给你你的分数,并问你是否要提交给Facebook。如果这样做,在我的脚本中,我已经完成了一个系统,检查您是否登录,如果您不是要求您登录,然后系统检查该应用是否具有发布权限,如果不是,请问您允许。如果所有这些都是真的,它会直接向你的墙发帖。所以希望登录/询问部分只需要完成一次。



问题:



当ipad在游戏和Facebook应用程序之间交换登录,ipad关闭游戏以节省内存。我试图减少现场,但是很难减少它。所以我想也许我应该打开Facebook登录和授权在游戏。为此,我尝试使用这个:

  setSessionLoginBehavior(FacebookSessionLoginBehavior.ForcingWebView); 

它完全正是我想要的,它在游戏中打开一个小窗口,不会崩溃所有真的好但是在这个解决方案中,问题在于,它只适用于登录,当我要求发布权限时,它将切换回Facebook应用程序来请求许可,从而崩溃。
经过更多的研究,似乎控制权限行为是不可行的。
所以回到正方形,如何防止IOS在用户连接到Facebook时关闭我的游戏。我还在寻找减少现场的情况。



我听说过离开Facebook应用程序后,发布了应用程序的URL并发送数据(我的游戏)请ipad在特定场合重新启动应用程序。但是,这将是真正的最后一个解决方案,因为它将需要大量的返工来做出这一切。



如果你有其他建议来解决这个问题,我是为它而起所有我需要的是登录 - >请求发布权限 - >发布,并回到我游戏的级别屏幕结束。



感谢您的帮助

解决方案

简单来说,一旦你的应用程序是背景知识,如果iOS想关闭它,你就不能防止这种情况发生。 >

您可以做的最好的事情是在将应用程序的状态转交到Facebook应用程序的身份验证端,然后在应用程序重新启动时重新载入您的状态。您将需要处理 applicationWillResignActive: applicationDidEnterBackground: applicationDidBecomeActive: applicationWillBecomeActive:



应用程序状态和多任务部分解释了如何执行此操作。 p>

I am really stuck on this problem and I need your help! I'm doing an ipad game with unity and the social network plugin from prime31.

The situation:

When you arrive to the end of level, the game gives you your score and ask if you want to submit it to facebook. If you do, In my script I've done a system that checks if you are logged in, if you aren't it ask you to login and then the system checks if the app has the publish permissions and if not it ask you the permission. If all theses if are true it posts a message to your wall straight. So hopefully the login/asking part needs to be done only once.

The problem:

When the ipad swap between the game and the facebook app to login, the ipad shutdown the game for saving memory. I've tried to reduce the scene, but it's hard to reduce it more than it is. So I thought maybe I should open that facebook login and authorisation inGame. For that I tried working with this:

setSessionLoginBehavior(FacebookSessionLoginBehavior.ForcingWebView);

And it does exactly what I want, it opens a small window in game, doesn't crash all good really. But the problem, in this solution, is that it only works for the login, and when I ask the publish permission it switches back to the facebook app to ask the permission and therefore crashes. After more research, it seems that it's not doable to control the ask permission behavior. So back to square one, how can I prevent IOS to shutdown my game while the user connects to facebook. I'm still looking to reduce the scene.

I heard of using the app url and sending data for the app (my game) launch after leaving the facebook app and therefore ask the ipad to relaunch the app at a specific scene. But that would be really the last solution because it's going to take a lot of rework to make that happened.

If you have another suggestions to work around this problem I'm up for it. All I need is login -> ask for publish permissions -> post and come back to the end of level screen of my game.

Thanks for the help

解决方案

Put simply, once your app is backgrounded, if iOS wants to shut it down, you can't prevent that from happening.

The best thing you can do is save the state of your app before handing over to the facebook app for the authentication side of things, and then reload your state when the app starts up again. You'll want to handle applicationWillResignActive:, applicationDidEnterBackground:, applicationDidBecomeActive: and applicationWillBecomeActive:.

The App States and Multitasking section of the iOS App Programming Guide explains how you can do this.

这篇关于当应用切换到Facebook进行登录和许可请求时,防止IOS关闭应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆