Difference between revisions of "IOS Promotion 4.1.0"
From AdLocus
(Created page with "== 前言 == 適地性優惠通知服務是依據全區定向或特定地理位置定向,提供您的使用者最適合的主動式訊息,同時具有高額的分潤收...") |
|||
Line 5: | Line 5: | ||
== 實作 == | == 實作 == | ||
− | * - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | + | * -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
* -(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification | * -(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification | ||
* -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler | * -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler |
Revision as of 11:39, 1 June 2016
前言
適地性優惠通知服務是依據全區定向或特定地理位置定向,提供您的使用者最適合的主動式訊息,同時具有高額的分潤收益。
啟動優惠通知服務,請將相關程式碼加在 AppDelegate 處。
實作
- -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- -(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
- -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
AppDelegate.m
#import "AppDelegate.h" #import <AdLocus/AdLocus.h> @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ALPushService *push = [ALPushService sharedInstance]; push.delegate = self; push.enable = YES; [application setMinimumBackgroundFetchInterval:60 * 60]; UILocalNotification *localNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; if (localNotification) { [ALPushService didReceiveLocalNotification:localNotification]; [[UIApplication sharedApplication] cancelLocalNotification:localNotification]; } return YES; } - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { [ALPushService didReceiveLocalNotification:notification]; } - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [ALPushService performFetchWithCompletionHandler:completionHandler]; }