IOS Promotion 5.1.8

From AdLocus
Revision as of 09:34, 5 June 2020 by Adlocuswikisysop (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

前言

適地性優惠通知服務是依據全區定向或特定地理位置定向,提供您的使用者最適合的主動式訊息,同時具有高額的分潤收益。

啟動優惠通知服務,請將相關程式碼加在 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.key = @"請填入您的APP KEY";
    push.enable = YES;
    // [push test]; //五秒後會出現測試廣告,可測試是否整合成功,正式發佈前須關閉。
 
    [application setMinimumBackgroundFetchInterval:60 * 60];
 
    UILocalNotification *localNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
    if (localNotification) {
        [ALPushService didReceiveLocalNotification:localNotification];
    }
 
    return YES;
}
 
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
    [ALPushService didReceiveLocalNotification:notification];
}
 
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    [ALPushService performFetchWithCompletionHandler:completionHandler];
}