iOS Universal Links on Older versions of iOS App - ios

I have two versions of my app, version 1 and version 2. In version 2 I added support for a new universal link /sign-up. I updated my app site association file to add /sign-up to the list of supported deep link URLs.
In version 1 I am returning false for /sign-up when I receive the UIApplicationDelegate callback for - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
In version 2, I am returning true for the same method and signing up the user.
The issue is that iOS is opening my app even for users on version 1, even though that version doesn't actually support this link.
How can I version universal links such that this sort of thing cannot happen in the future?

Related

Deep linking callback issues in iOS11

I have implemented deep linking in my app using URL schema which is working properly in all versions of iOS except 11. The issue is when I load AppURLSchema:// in the device browser it launches the app but none of the appDelegate methods gets called to get the deep linking URL so that I can perform deep linking so that user will be able to see different content based upon the URL.
None of the following functions are getting called:
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
This is not an issue on iOS 10, it seems to have been introduced in iOS 11.
Any help will be appreciated.
Thanks!!
I'm facing the same problem and I discovered that the SDK Firebase integrated in my app is blocking the following callback: application:openURL:options.
Without configuring Firebase, all is working ok.
It's not just Configuring Firebase SDK causing this issue. With Firebase SDK it's working fine but There is Localytics SDK also integrated in my app and there is some conflict between FIREBASE and LOCALYTICS SDKs due to which my app was not getting the callback.
So I just removed Firebase framework based upon the priority and everything started working fine.
As mentioned in Localytics Documentation, integrations for both platforms can lead to conflicts, particularly around the handling of deeplinks.
You can prevent Firebase from swizzling the methods in your AppDelegate by adding FirebaseAppDelegateProxyEnabled set to NO in your app's info.plist as described in Firebase documentation.

iOS Branch deep link does not open application on device, but works well on simulator

Could anybody help me out please?
iOS Branch deep link does not open application on device, but works well on simulator. My simulator OS version is 10.3, my iPhone 5s OS version is 10.3.3
What I have done:
Dashboard: Settings -> Link Settings:
"Always try to open app" is checked
"IOS URI Scheme" is set to the application's custom URI scheme.
"Enable Universal Links" is checked.
Bundle Identifier & Apple App Prefix are both set correctly.
Link Domain was set as bellow:
Test Link was created as bellow:
Xcode Configuration:
1.Associated Domains
2.Info.plist file
And, code as bellow:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
[[Branch getInstance] handleDeepLink:url];
BOOL success = NO;
success = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
if (!success) {
success = [router handleURL:url withCompletion:nil];
}
//force return YES
return YES;
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
BOOL ret = NO;
ret = [[Branch getInstance] continueUserActivity:userActivity];
if (!ret) {
ret = [router handleUserActivity:userActivity withCompletion:NULL];
}
//force return YES
return YES;
}
What I tested:
I sent the Test Deep Link to my email, and I open the email through Safari. While I click the url on DEVICE, an alert was shown to tell me App Store will be open. While I click the url on SIMULATOR, my app was open successfully.
I pasted the Test Deep Link into Notes on DEVICE, while I click the url, an action sheet was shown and provide two option: open in Safari, Open in xxx(my app name). I click both options, they all could open my app successfully.
Here is all the configuration, code, steps, and I have also tried to change branch_app_domain to applinks:xxxapp.app.link, it didn't work neither.
Is there anything that I missed during the integration procedure? Any suggestion would be very appreciate. Thanks in advance!
Roby
Amruta from Branch.io here:
I tested with your App available on the App Store and Universal links work as expected. I shared the link via Slack, the default Email App on iOS as well as the Gmail app. On all three platforms clicking on the Branch link for your App opened your App via Universal links as expected.
Based on your description of testing it looks like you are disabling Universal links (clicking the breadcrumb on the top right link disables Universal links.
To re-enable Universal Links for an app:
1. Paste one of your Branch links into a new note
2. Perform a long press on the link (note: if you see a "preview" window pop open, you are pressing too hard)
Note that this is a 'per-device' issue, so if you accidentally disable Universal Links on one phone, it won't affect other users.
Unfortunately, there is no way to ensure that a user does not disable Universal links by mistake. However, there is a silver lining, this will no longer be an issue post iOS 11. With iOS 11 the breadcrumb in the top right corner has disappeared and so has the ability to disable Universal Links.

iOS 9 Universal Links don't work

I tried to implement universal links in my application, but it's not working. I uploaded the apple-app-site-association file to my server, i can access it.
(MIME type: application/json)
Here is the content of the apple-app-site-association file:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "L7LAMSGWAK.com.example.app",
"paths": [
"*"
]
} ]
}
}
I turned on the Associated domains in my application, and i added these domains:
applinks:example.com
applinks:demo.example.com
(i uploaded the apple-app-site-association file to the demo.example.com domain too)
In the AppDelegate.m file i wrote this:
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
NSURL* openedUrl = userActivity.webpageURL;
NSString* urlString = [openedUrl.absoluteString lowercaseString];
return YES;
}
And i set a breakpoint into this method to check if its called, but its never called. If i click on for example this link: https://demo.example.com/asd its just open the safari, but i never see the banner to open the link in my application. I really dont know whats wrong.
Try to delete and reinstall the app. iOS processes associated domain details and attempts to read the apple-app-site-association file at app install. It worth trying it with a real device (instead of the Simulator) and check device logs (Xcode > Window > Devices and select your device). If you see anything like ### Rejecting URL 'https://demo.example.com/apple-app-site-association' for auth method 'NSURLAuthenticationMethodServerTrust': -6754/0xFFFFE59E kAuthenticationErr, then probably your site's certificate is not good enough for iOS or there is some other issue with downloading your association file.
Kind of a late answer, but I had the same problem when I was trying to implement universal links. The solution for me was to test using a real device.
The Apple documentation lists that it's possible to test on a simulator, but with my own experience, it hasn't been possible.
You can test universal links in Simulator or on a device. Source - Apple
I also tried using Branch.io and they state that it's not possible to test using a simulator.
You should also verify that you're using a device that's running iOS >= 9.2

How does flurry analytics track my apps version number?

I'm viewing my top used version numbers in flurry for my app. It appears flurry is using the build number field (bundle version) in my plist to report what version a particular app is. Is this true? If so, can I have use a different field in my plist? (i.e Bundle Version string short) How? I frequently change the build number and I want to see something like 1.0.1 (a version) instead of 28 (a build number) in flurry.
I got bit by this too, it seems bizarre to me they would use the build number by default. I added an auto-incrementing build number script and by the time I next checked Flurry, it showed about 100 different "versions", each just a new build. Ugh, what a mess.
The good news is the Flurry API provides a way to explicitly set the reported app version at runtime. I have a #define in my prefix file that links to the "short version string", which in Apple's system is basically your user-facing app version (e.g. "1.0.2"), and is probably the one you want to be tracked in Flurry.
#define kAppVersion [[NSBundle mainBundle] objectForInfoDictionaryKey:#"CFBundleShortVersionString"]
Doing it this way means that you don't have to remember to set the version in more than one place. Set it in your target's "Identity" section or in the Info.plist file and you're done.
Then in my app delegate's application:didFinishLaunchingWithOptions: method, when I start up Flurry collections, I tell it to use that.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Flurry setCrashReportingEnabled:YES];
[Flurry setAppVersion:kAppVersion]; // <-- will now report your short version string
[Flurry startSession:kFlurryAPIKey];
// ...
}
Above method is deprecated instead user as below.
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
Flurry.startSession("xxxxxxxxxxxxxxxxxxx", with: FlurrySessionBuilder
.init()
.withCrashReporting(true)
.withLogLevel(FlurryLogLevelAll).withAppVersion(version))
}

How many people have installed my app as a result of Facebook ads?

I've followed the instructions on this page for my Xcode project (ios app): https://developers.facebook.com/docs/ios/getting-started/
installed the Facebook SDK for iOS
obtained Facebook App ID
configured Xcode project
archived Xcode proj, submitted to Apple, approved and live
And I've created and run ads for app installs however how do I know how many people have installed my app as a result of the ads? There is nothing showing top left of the ads page....just zero???? Nothing showing in my Facebook Developer account.
I've clearly missed a pretty obvious step...can someone please shed some light?
You're probably not calling [FBAppEvents activateApp] on applicationDidBecomeActive:.
Check also if you have a FacebookAppID key on your target's Info.plist.
You AppDelegate needs to look like this:
#import "AppDelegate.h"
#import <FacebookSDK.h>
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// stuff
return YES;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBAppEvents activateApp];
}
#end

Resources