Created
February 15, 2022 07:46
-
-
Save tssandor/99e0275e45106c9759ba782a59291ff6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
@interface AppDelegate () | |
@end | |
@implementation AppDelegate | |
NSString *integrationKey = @"your integration key here"; | |
- (BOOL)application:(UIApplication *)application | |
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
Publisher* publisher = Publisher.shared; | |
/// setup event. You need implement method from `PublisherDelegate` | |
publisher.delegate = self; | |
/// setup integration key | |
[publisher setup: integrationKey]; | |
/// if this value is true it will not show custom alert from our | |
location SDK and if false it will show custom alert that we can update | |
the message | |
publisher.disableAlertWhenUserDenied = false; | |
/// this is custom alert title to request access location | |
publisher.requestAccessAlertTitle = @"Need Location Access"; | |
/// this is custom alert message to request access location | |
NSString *bundleName = [NSBundle.mainBundle | |
objectForInfoDictionaryKey:(id)kCFBundleNameKey]; | |
publisher.requestAccessAlertMessage = [NSString stringWithFormat:@"% | |
@ %@", @"Please give authorization location access to continue the | |
process. Go to Settings > Privacy > Location Services", bundleName]; | |
///start tracking location. After you call this method, our SDK | |
will automatically tracking event and do the logic for you | |
[publisher startTrackingLocation]; | |
return YES; | |
} | |
#pragma mark - PublisherDelegate | |
- (UIViewController * _Nullable)publisherControllreParent { | |
NSPredicate *isKeyWindow = [NSPredicate predicateWithFormat:@" | |
isKeyWindow == YES"]; | |
return [[[UIApplication sharedApplication] windows] | |
filteredArrayUsingPredicate:isKeyWindow].firstObject.rootViewController; | |
} | |
- (void)publisherOnErrorWithError:(NSError * _Nonnull)error { | |
NSLog(@"qdPublisher %@", error.localizedDescription);} | |
- (void)publisherOnSuccessTracking { | |
NSLog(@"qdPublisher Success"); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment