How to have a paid and free version of iOS app share FB App ID?

让人想犯罪 __ 提交于 2019-12-21 02:42:21

问题


I have a free and a paid version of the same iPhone app. I would like for them to share a Facebook App ID since they are essentially the same app. I thought I could accomplish this by using this method from the Facebook class.

- (void)authorize:(NSArray *)permissions localAppId:(NSString *)localAppId

However, login always fails for one of the apps (in my case the free version) and it would seem that the reason is that the Facebook app created in the web interface asks for an App Bundle ID and App Store ID. Obviously the free version and paid version of my apps cannot have the same bundle id or app id so how can I make this work?

The docs in Facebook.m suggest that it is possible with the authorize method I mention above:

/*
 * ...
 * @param localAppId
 *            This is useful if your have multiple iOS applications that
 *            share a single Facebook application id (for example, if you
 *            have a free and a paid version on the same app) and you want
 *            to use SSO with both apps. 
 * ...
 */

Thanks. - Alex


回答1:


You can make it work. Each app must have different url schemes (since that is how Facebook redirects back to your app).

Example url schemes you must support: (Your facebook app id: "fb123456789")

Without setting localAppId: "fb123456789" (localAppId = nil)

Free app url scheme: "fb123456789lite" (localAppId = "lite")

Paid app url scheme: "fb123456789pro" (localAppId = "pro")

From the comments:

localAppId is a string of lowercase letters that is appended to the base URL scheme used for SSO. For example, if your facebook ID is "350685531728" and you set localAppId to "abcd", the Facebook app will expect your application to bind to the following URL scheme: "fb350685531728abcd".



来源:https://stackoverflow.com/questions/7368515/how-to-have-a-paid-and-free-version-of-ios-app-share-fb-app-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!