简体   繁体   English

处理传入请求(Facebook iOS SDK)

[英]Handling Incoming Requests (Facebook iOS SDK)

I am of the knowledge that the following method only gets implemented when the app is opened via the Facebook flow ie via a notification in the facebook iOS app 我知道以下方法仅在通过Facebook流程即通过Facebook iOS应用中的通知打开应用时才实现

      - (BOOL)application:(UIApplication *)application 
                  openURL:(NSURL *)url
        sourceApplication:(NSString *)sourceApplication 
               annotation:(id)annotation 
        {
           return [FBSession.activeSession handleOpenURL:url]; 
        }

The url received in this method is used for handling incoming requests sent by another user. 通过此方法接收的url用于处理其他用户发送的传入请求。 I had a few questions regarding the same. 我对此有几个问题。

  1. So does that mean that the handling of the requests cant be tested on iOS simulator as there is no facebook app installed? 那么这是否意味着因为未安装任何Facebook应用,所以无法在iOS模拟器上测试请求的处理?

  2. Or if the functionality can be tested using Safari on the simulator, do we need to have an iPhone app store id so that our app can be redirected to from the browser? 或者,如果可以在模拟器上使用Safari进行功能测试,是否需要拥有iPhone应用商店ID,以便可以从浏览器重定向到我们的应用?

  3. Consequently does that mean no testing of incoming request without an iTunes Connect account? 因此,这是否意味着没有iTunes Connect帐户就无法测试传入请求?

  1. That depends on what you mean by requests. 这取决于您的要求。 You can write a test app that calls the custom URL scheme you define or test it from within Safari. 您可以编写一个测试应用程序来调用您定义的自定义URL方案,也可以在Safari中对其进行测试。 If by 'requests' you mean push notifications, this would be a good way to simulate them. 如果“请求”是指推送通知,那么这是模拟它们的好方法。 Push notifications are unsupported by the simulator however. 但是,模拟器不支持推送通知。 You will an iOS device to test them. 您将使用iOS设备进行测试。

  2. See above. 往上看。 When you create a link, like a regular HTML anchor, to a custom url scheme and the application that's "listening" for these url's is installed, it will be opened when the user presses the link. 当您创建到常规URL锚的链接(如常规HTML锚)并且安装了“监听”这些URL的应用程序时,当用户按下链接时,它将打开。 eg <a href="yourapp://path/?bar=1&foo=2">Link</a> 例如<a href="yourapp://path/?bar=1&foo=2">Link</a>

  3. Perhaps you can elaborate on what you mean with 'incoming requests'. 也许您可以详细说明“传入请求”的含义。 If you are referring to push-notifications then yes, you will need a developer account to be able to test push-notifications. 如果您指的是推送通知,则可以,您将需要一个开发人员帐户才能测试推送通知。 Also, they would only work on hardware and not in the simulator. 而且,它们只能在硬件上工作,而不能在模拟器中工作。 You could then look into ways of simulating notifications as I described above. 然后,您可以如上所述研究模拟通知的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM