开发者

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

开发者 https://www.devze.com 2023-04-04 01:53 出处:网络
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 metho

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 开发者_JS百科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


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".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号