如何重新启动类似facebook-ios-sdk的应用程序? [英] How to relaunch an app like facebook-ios-sdk does?

查看:90
本文介绍了如何重新启动类似facebook-ios-sdk的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

我本人正在积极寻找Github的facebook-ios-sdk项目的源代码,但我想知道是否有人已经知道如何重新启动将iPhone用户发送到Safari的应用程序,以便该用户在经过一段时间后可以回来工作已经完成了吗?

I am actively looking in the source code on Github's facebook-ios-sdk project myself but I was wondering if anyone already knows how to relaunch an app that sent an iPhone user to Safari, such that the user can come back after some work has been finished?

示例:

使用Facebook登录时,原始应用在Facebook登录页面对用户进行身份验证后重新启动.

When using facebook to login, the original app is relaunched after the facebook login page has authenticated the user.

动机:

我希望能够对youtube视频执行相同的操作,而不必完全失去用户.我不想使用标准的Webview方法,因为我不想提供额外的空间来首先让用户加载视频,然后让用户单击播放"按钮.我想完全跳过播放按钮及其相关的单击!取而代之的是,我希望用户只能单击日常的iPhone按钮,并向其显示带有导航的视频,以便通过重新启动返回到应用程序.

I would like to be able to do the same for youtube videos without having to completely lose the user. I don't want to use the standard webview approach because I don't want to provide extra space to first let the video load for the user and then have the user click the play button. I want to skip the play button and its associated click entirely! Instead I want the user to be able to click on just an everyday regular iPhone button and be shown the video with the navigation for coming back to the app via relaunch.

推荐答案

您需要您的应用程序才能注册自定义URL方案".然后在远程Web服务中获取回调,以使用该方案返回URL.然后,iOS将启动您的应用程序.

You need your app to register a "custom URL scheme". Then get the callback in the remote web service to return a URL with that scheme. iOS will then launch your application.

  • More (somewhat old) info available here.
  • A list of common custom URL schems on iOS can be found here.

通常,作为OAuth登录过程的一部分,您提供一个回调URL作为参数之一.这样做是告诉远程服务器(YouTube),在成功进行身份验证后,将用户重定向到提供的URL.如果YouTube支持此功能(是否支持OAuth?),则在Safari浏览器中成功登录用户后,youtube会告诉Safari浏览器重定向到提供的网址.如果此url是自定义URL方案",它将导致您的应用重新启动,您可以从那里处理情况.

Generally, as part of the OAuth login process, you supply a callback URL as one of the paramaters. What this does, is tell the remote server (YouTube), that on successful authentication, redirect the user to the supplied URL. If YouTube supports this (does it support OAuth?) then on successful user login within safari, youtube will tell users safari to redirect to the supplied url. If this url is a "custom URL scheme" it will cause your app to relaunch and you can handle the situation from there.

这篇关于如何重新启动类似facebook-ios-sdk的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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