Facebook URL Schemes for both Free and Paid Apps - ios

I have set up the URL scheme suffix on Facebook to have a "paid" and "free" version of my app. Now, I have submitted a paid and free version of my App on the App Store using 2 different bundle identifiers: com.mycompany.myapppaid and com.mycompany.myappfree. I have used the correct URL type for each app (fbMYFACEBOOKIDpaid, and fbMYFACEBOOKIDfree).
According to the Facebook app page, there is only a single spot for a single bundle identifier, how does Facebook differentiate between the two?

From a previous question I answered:
Mark your app as "Web".
Bundle ID is not necessary.
EDITED FOR NEW VERSION OF FACEBOOK IOS SDK:
- (id)initWithAppId:(NSString *)appId
urlSchemeSuffix:(NSString *)urlSchemeSuffix
andDelegate:(id<FBSessionDelegate>)delegate;
When you initialize the Facebook object, you need to initialize it with the appropriate "paid" or "free" suffix.
OLD ANSWER:
Call - (void)authorize:localAppId: accordingly
The key is to mark your App Type as "Web" instead of "Native/Desktop"
when you are filling out your app info on the Facebook create app
pages. When you are Native/Desktop app it requires the Bundle ID and
checks against that in the callback. If you are web app it ignores it.
You don't need to put anything in the web interface. When you want to
authorize facebook, call [_facebook authorize:_permissions
localAppId:#"free"]; or [_facebook authorize:_permissions
localAppId:#"paid"];

Related

App Store link parameters / InstallReferrerReceiver equivalent on iOS

I'm aware that on Android you have the ability to add the parameter referrer to a Play Store URL the parameter will be passed to the app on app launch...
e.g.
http://market.android.com/details?id=your.application.package.name&referrer=my_referrer_finally_works_fine
Is there a similar parameter on iOS? I'm looking to link my users to the app store and launch them into a specific screen once they launch.
Links for InstallReferrerReceiver
https://developers.google.com/android/reference/com/google/android/gms/tagmanager/InstallReferrerReceiver
Get referrer after installing app from Android Market
I went with a mixture of Firebase and universal links in the end
https://firebase.google.com/
https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html

How to set FacebookUrlSchemeSuffix build hint in Codename One

I have two free and paid apps which use same one Facebook app.
The free app has package: com.company.app
The paid app has package: com.company.app.free
The facebook app has id is 123456 and the iOS platform section in Facebook app:
"Bundle ID": com.company.app.free, com.company.app
"URL Scheme Suffix": free, paid
I can't logon the facebook in freeApp because the facebook always redirects to the paidApp.
After spend time, I found the Two iOS apps using the same Facebook app ID - is it possible? and https://developers.facebook.com/docs/ios/troubleshooting#sharedappid and try:
Add the ios.FacebookUrlSchemeSuffix="free" for freeApp and ios.FacebookUrlSchemeSuffix="paid" for paidApp but the problem is still same.
Then remove the ios.FacebookUrlSchemeSuffix build hint above, add the ios.plistInject=< key>FacebookUrlSchemeSuffix< /key>< string>free < /string> for freeApp and test it. The app is terminated immediately when start logon the facebook.
Then add the ios.urlScheme=fb123456 to the freeApp but the build is failed at server with error "...Info.plist': The data couldn’t be read because it isn’t in the correct format."
What are correct setting for ios.urlScheme and ios.plistInject build hints (include the FacebookUrlSchemeSuffix) in order for both freeApp and paidApp can work correctly in Codename One?
ios.urlScheme
Allows intercepting a URL call using the syntax
urlPrefix
From: https://www.codenameone.com/manual/advanced-topics.html
Notice that by default defining Facebook support includes the main URL scheme so the plistInject will conflict with that.

iOS Custom Url Scheme XCode

First of all, I know how to make custom schemes in iOS and I know how to open my app from a website using a javascript setTimeout method.
I have an app that uses custom URL scheme and it is working great. What it does is, it sends a http://testsite.com/QueryStrings message to other users in the contact list (predefined) and on clicking those web links in the sms, these things happen:
Open the link in Safari
Open the app if installed with custom url using setTimeout
If not installed, move to the normal website page
What I wanted actually is to open my app directly from SMS if installed but for that I have to send my custom url scheme in the SMS, that is not an option because if app is not installed then this SMS wont work so a weblink is the only option for now.
Today, I installed SoundCloud and accidentally noticed this thing is that when http:// m. soundcloud .com /... url is sent in an SMS and on clicking the link it opens the app (if installed) directly not the Safari (Strange for me).
So I was wondering how come their app open from a web link without opening the Safari. I googled it around but I couldn't find a solution to my problem. I am attaching a screenshot too from my mobile where press and hold on the link in the messages app give Open in "SoundCloud" option as well. So how SoundCloud registered a http link to be handled automatically in the app. Please help guys
Screenshot of SoundCloud Open
The answer to this problem is using Associated Domains (But after 9.2 we have to use Universal Links to achieve this).
Before Universal Links, the primary mechanism to open up an app when it was installed was by trying to redirect to an app’s URI scheme (registered in the app’s PLIST like so) in Safari. This put the routing logic in Safari, but there was no way to check if the app was installed or not.
iOS 9 Universal Links were intended to fix this. Instead of opening up Safari first when a link is clicked, iOS will check if a Universal Link has been registered for the domain associated with the link, then check if the corresponding app is installed. If the app is currently installed, it will be opened. If it’s not, Safari will open and the http(s) link will load.
Functionally, it allows you have a single link that will either open your app or open your mobile site.
Configure your app to register approved domains
Registered your app at developers.apple.com
Enable ‘Associated Domains’ on your app identifier
Enable ‘Associated Domain’ on in your Xcode project
Add the proper domain entitlement
Make sure the entitlements file is included at build
Configure your website to host the ‘apple-app-site-association’ file
Buy a domain name or pick from your existing
Acquire SSL certification for the domain name
Create structured ‘apple-app-site-association’ JSON file
Sign the JSON file with the SSL certification
Configure the file server
Apple launched Universal Links in iOS 9.0, which moves the app routing into the OS so that developers don’t need to worry about doing the routing in Javascript.
Receiving Universal Link URL in the App
URI schemes received the deep link URL through openUrl in the App Delegate. Universal Links receive their data via a different code path: continueUserActivity. This new delegate method is used for a number of app transitions, ranging from Spotlight to Universal Links, and will likely see a couple more use cases introduced in future OS versions.
Below is a snippet of code that you can use to retrieve the full Universal Link URL that opened the app.
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSString *myUrl = [userActivity.webpageURL absoluteString];
// parse URL string or access query params
}
return YES;
}
Source: https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9

How to get Facebook attribution ID on iOS?

Facebook attribution ID is available if user installed Facebook app on his phone.
On Android, it can be extracted with this piece of code -
Report Android app install back to facebook without using their api
By looking at Facebook's SDK for iOS, they access it with -
+ (NSString *)attributionID {
return [[UIPasteboard pasteboardWithName:#"fb_app_attribution" create:NO] string];
}
(https://github.com/facebook/facebook-ios-sdk/blob/master/src/FBUtility.m)
But when I call this method on a phone with FB app installed, it returns nil.
How do I extract it on iOS?
Unfortunately I think the answer is that you can't do this. At least for as long as Facebook is using the UIPasteboard.
That code in your post would access an app-specific pasteboard. If it was created by the Facebook application then it would only be accessible to Facebook's other applications.
The UIPasteboard class enables an app to share data within the app and
with another app. To share data with any other app, you can use
system-wide pasteboards; to share data with another app that has the
same team ID as your app, you can use app-specific pasteboards.
The quote above is from the docs

"itms-apps://" URL for iOS app that has not been released yet

My paid iOS app is under review to be released only in the Japan App Store. I'd like to create the free version with a link to paid version, but don't have the URL of the paid version.
http://itunes.apple.com/linkmaker/ is mentioned in this question, but when I search for my app there, it doesn't show up.
Another option suggested is to create a permalink on our domain, but that will force the user through extra redirects.
iTunes connect gives my app url as starting with "http://itunes.apple.com/us/app/dumi-shuki-ying-yu/" Clicking that link gives a warning that it's the app is currently only available in the US (though we released it only for Japan).
I have the SKU and bundle ID, but what can I use for the URL?
This works on my end (Xcode 5 - iOS 7 - Device!):
itms-apps://itunes.apple.com/app/idYOUR_APP_ID
Code snippet (you can just copy& paste it):
#define YOUR_APP_STORE_ID 123456789 // Change this one to your app ID (get it from iTunes Connect)
static NSString *const iOS7AppStoreURLFormat = #"itms-apps://itunes.apple.com/app/id%#";
[NSURL URLWithString:[NSString stringWithFormat:iOS7AppStoreURLFormat, YOUR_APP_STORE_ID]]; // Would contain the right link
Pay attention that we didn't use the app name (isn't needed and it is bad to use because it's subject to change). On iOs 7 you can also use "http" instead of "itms-apps" and that would have same result (won't open safari first like on older OS).
Last important thing is that we haven't used the country data on the link (usually "us" or any other) so the device would select the relevant one. If you do write "us" on the link (like the one you get from iTunes Link Maker) if you open that on Japanese device if could show an alert because store is probably set to Japan and won't open the link.
The link you get in iTunes Connect should work just by replacing http:// with itms-apps://.
That being said this alert is strange, do you have anything linked to your iTunes account set to U.S English? I'm guessing this is just automatic, and once your app is approved this link should work provided the user that clicks the link's iTunes account is associated with the Japanese store.

Resources