diff --git a/plugin.xml b/plugin.xml index 29e03bb..342682b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -31,7 +31,7 @@ - + @@ -43,7 +43,8 @@ - + + $API_KEY diff --git a/src/ios/Plugins/JPushPlugin.m b/src/ios/Plugins/JPushPlugin.m index 32b4ec0..9428d33 100644 --- a/src/ios/Plugins/JPushPlugin.m +++ b/src/ios/Plugins/JPushPlugin.m @@ -9,10 +9,12 @@ #import "JPushPlugin.h" #import "JPUSHService.h" #import +#import -static NSString *const JM_APP_KEY = @"APP_KEY"; -static NSString *const JM_APP_CHANNEL = @"CHANNEL"; -static NSString *const JM_APP_ISPRODUCTION = @"IsProduction"; +static NSString *const JP_APP_KEY = @"APP_KEY"; +static NSString *const JP_APP_CHANNEL = @"CHANNEL"; +static NSString *const JP_APP_ISPRODUCTION = @"IsProduction"; +static NSString *const JP_APP_ISIDFA = @"isIDFA"; static NSString *const JPushConfigFileName = @"PushConfig"; static NSDictionary *_luanchOptions = nil; @@ -273,17 +275,26 @@ static NSDictionary *_luanchOptions = nil; } NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath]; - NSString * appkey = [plistData valueForKey:JM_APP_KEY]; - NSString * channel = [plistData valueForKey:JM_APP_CHANNEL]; - NSNumber * isProduction = [plistData valueForKey:JM_APP_ISPRODUCTION]; + NSString * appkey = [plistData valueForKey:JP_APP_KEY]; + NSString * channel = [plistData valueForKey:JP_APP_CHANNEL]; + NSNumber * isProduction = [plistData valueForKey:JP_APP_ISPRODUCTION]; + NSNumber *isIDFA = [plistData valueForKey:JP_APP_ISIDFA]; if (!appkey || appkey.length == 0) { NSLog(@"error: app key not found in PushConfig.plist "); assert(0); } - [JPUSHService setupWithOption:_luanchOptions appKey:appkey - channel:channel apsForProduction:[isProduction boolValue] ]; + NSString *advertisingId = nil; + if(isIDFA){ + advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; + } + [JPUSHService setupWithOption:_luanchOptions + appKey:appkey + channel:channel + apsForProduction:[isProduction boolValue] + advertisingIdentifier:advertisingId]; + } #pragma mark 将参数返回给js diff --git a/src/ios/PushConfig.plist b/src/ios/PushConfig.plist index 6800671..e6c1917 100644 --- a/src/ios/PushConfig.plist +++ b/src/ios/PushConfig.plist @@ -8,5 +8,7 @@ Subscription IsProduction + isIDFA + diff --git a/src/ios/lib/JPUSHService.h b/src/ios/lib/JPUSHService.h index 15435bd..62f6500 100755 --- a/src/ios/lib/JPUSHService.h +++ b/src/ios/lib/JPUSHService.h @@ -9,7 +9,7 @@ * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. */ -#define JPUSH_VERSION_NUMBER 2.1.0 +#define JPUSH_VERSION_NUMBER 2.1.6 #import @@ -51,6 +51,7 @@ extern NSString *const kJPFServiceErrorNotification; // 错误提示 * @param appKey 一个JPush 应用必须的,唯一的标识. 请参考 JPush 相关说明文档来获取这个标识. * @param channel 发布渠道. 可选. * @param isProduction 是否生产环境. 如果为开发状态,设置为 NO; 如果为生产状态,应改为 YES. + * @param advertisingIdentifier 广告标识符(IDFA) 如果不需要使用IDFA,传nil. * * @discussion 提供SDK启动必须的参数, 来启动 SDK. * 此接口必须在 App 启动时调用, 否则 JPush SDK 将无法正常工作. @@ -61,6 +62,13 @@ extern NSString *const kJPFServiceErrorNotification; // 错误提示 apsForProduction:(BOOL)isProduction; ++ (void)setupWithOption:(NSDictionary *)launchingOption + appKey:(NSString *)appKey + channel:(NSString *)channel + apsForProduction:(BOOL)isProduction + advertisingIdentifier:(NSString *)advertisingId; + + ///---------------------------------------------------- /// @name APNs about 通知相关 ///---------------------------------------------------- @@ -78,6 +86,7 @@ extern NSString *const kJPFServiceErrorNotification; // 错误提示 + (void)registerDeviceToken:(NSData *)deviceToken; + /*! * @abstract 处理收到的 APNs 消息 */ @@ -97,7 +106,7 @@ extern NSString *const kJPFServiceErrorNotification; // 错误提示 + (void) setTags:(NSSet *)tags alias:(NSString *)alias callbackSelector:(SEL)cbSelector - target:(id)theTarget; + target:(id)theTarget __attribute__((deprecated("JPush 2.1.1 版本已过期")));; + (void) setTags:(NSSet *)tags alias:(NSString *)alias @@ -108,9 +117,9 @@ callbackSelector:(SEL)cbSelector callbackSelector:(SEL)cbSelector object:(id)theTarget; -+ (void) setTags:(NSSet *)tags - alias:(NSString *)alias -fetchCompletionHandle:(void (^)(int iResCode, NSSet *iTags, NSString *iAlias))completionHandler; ++ (void)setTags:(NSSet *)tags + alias:(NSString *)alias + fetchCompletionHandle:(void (^)(int iResCode, NSSet *iTags, NSString *iAlias))completionHandler; + (void) setTags:(NSSet *)tags aliasInbackground:(NSString *)alias; diff --git a/src/ios/lib/jpush-ios-2.1.0.a b/src/ios/lib/jpush-ios-2.1.6.a similarity index 56% rename from src/ios/lib/jpush-ios-2.1.0.a rename to src/ios/lib/jpush-ios-2.1.6.a index 319d1a0..fca9af9 100644 Binary files a/src/ios/lib/jpush-ios-2.1.0.a and b/src/ios/lib/jpush-ios-2.1.6.a differ