Skip to content

Instantly share code, notes, and snippets.

@gelinger777
Last active October 28, 2021 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gelinger777/f81e026d3040116a23caecd460add8d9 to your computer and use it in GitHub Desktop.
Save gelinger777/f81e026d3040116a23caecd460add8d9 to your computer and use it in GitHub Desktop.
AppsFlyer Ionic AppDelegate v3 (Only for SDK > 6.2.30) Works for Ionic Cordova >= 4
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
//
// AppDelegate.m
// Dignisi
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import "AppDelegate.h"
#import "MainViewController.h"
#import "AppsFlyerPlugin.h"
#import <AppTrackingTransparency/AppTrackingTransparency.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
self.viewController = [[MainViewController alloc] init];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
//If you want to do something with the pop-up
}];
}
}
// Deep linking
// Open URI-scheme for iOS 9 and above
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *) options {
// version >= 6.2.30
[[AppsFlyerAttribution shared] handleOpenUrl:url options:options];
// version < 6.2.30
[[AppsFlyerLib shared] handleOpenUrl:url options:options];
return YES;
}
// Open Universal Links
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
// version >= 6.2.30
[[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
//version < 6.2.30
[[AppsFlyerLib shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
return YES;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment