diff --git a/API/iOS_install.md b/API/iOS_install.md
deleted file mode 100644
index b445c30..0000000
--- a/API/iOS_install.md
+++ /dev/null
@@ -1,62 +0,0 @@
-### iOS 手动安装
-
-- 下载 JPush PhoneGap 插件,并解压缩,标记插件目录为:`$JPUSH_PLUGIN_DIR`
-
-- 用 xcode 打开 iOS 工程 将 `$JPUSH_PLUGIN_DIR`/src/ios/Plugins/ 拖到 project 中
-
-- 将 `$JPUSH_PLUGIN_DIR`/src/ios/lib/ 拖到 project 中
-
-- 添加以下框架,打开 xcode,点击 project,选择(Target -> Build Phases -> Link Binary With Libraries)
-
- CFNetwork.framework
- CoreFoundation.framework
- CoreTelephony.framework
- SystemConfiguration.framework
- CoreGraphics.framework
- Foundation.framework
- UIKit.framework
-
-
-- 在你的工程中创建一个新的 Property List 文件
-
- 并将其命名为 PushConfig.plist,填入 Portal 为你的应用提供的 APP_KEY 等参数
-
-- 在 AppDelegate.m 中包含头文件
-
- #import "JPUSHService.h"
- #import "JPushPlugin.h"
-
-- 在 AppDelegate.m 中的下列方法中添加代码,如果方法不存在则增加相应方法与内容
-
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
- //原内容保持不变
- //Required add
- [JPushPlugin setLaunchOptions:launchOptions];
- return YES;
- }
- - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
- //原内容保持不变
- // Required add
- [JPUSHService registerDeviceToken:deviceToken];
- }
- - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
- //原内容保持不变
- // Required add
- [JPUSHService handleRemoteNotification:userInfo];
- [[NSNotificationCenter defaultCenter] postNotificationName:kJPushPluginReceiveNotification object:userInfo];
- }
-
-- 修改 phonegap config.xml 文件用来包含 Plugin/ 内的插件
-
-
-
-
-
-
-
-
-- 复制 `$JPUSH_PLUGIN_DIR`/www/JPushPlugin.js 到工程的 www 目录下面
-
-- 在需要使用插件处加入
-
-
diff --git a/README.md b/README.md
index 8ad898c..852b8dd 100644
--- a/README.md
+++ b/README.md
@@ -55,9 +55,9 @@
git clone https://github.com/jpush/jpush-phonegap-plugin.git
cordova plugin add $JPUSH_PLUGIN_DIR --variable API_KEY=your_jpush_appkey
-[Android 手动安装文档地址](API/Android_handle_install.md)
+[Android 手动安装文档地址](/doc/Android_handle_install.md)
-[IOS 手动安装文档地址](API/iOS_install.md)
+[IOS 手动安装文档地址](/doc/iOS_install.md)
#### 2.安装 org.apache.cordova.device 插件
@@ -97,11 +97,11 @@ iOS:
### 具体的 API 请参考:
-- [公共 API](https://github.com/jpush/jpush-phonegap-plugin/blob/dev/API/Common_detail_api.md)
+- [公共 API](/doc/Common_detail_api.md)
-- [iOS API](https://github.com/jpush/jpush-phonegap-plugin/blob/dev/API/iOS%20API.md)
+- [iOS API](/doc/iOS_API.md)
-- [Android API](https://github.com/jpush/jpush-phonegap-plugin/blob/dev/API/Android_detail_api.md)
+- [Android API](/doc/Android_detail_api.md)
## 常见问题
@@ -117,19 +117,18 @@ eclipse 中 import PhoneGap 工程之后出现:`Type CallbackContext cannot be
### 2. iOS
-- 设置 / 修改 APP_KEY:
-
- 在 PushConfig.plist 中修改。
- PushConfig.plist 中其他值说明:
-
- - CHANNEL: 渠道标识。
- - IsProduction: 是否生产环境(暂未启用)。
-
-
- 收不到推送:
- 请首先按照正确方式再次配置证书、描述文件
- [iOS 证书设置指南](http://docs.jpush.io/client/ios_tutorials/#ios_1)。
+ 请首先按照正确方式再次配置证书、描述文件
+ [iOS 证书设置指南](http://docs.jpush.io/client/ios_tutorials/#ios_1)
+
+- 设置 PushConfig.plist:
+
+ - APP_KEY:应用标识
+ - CHANNEL:渠道标识
+ - IsProduction:是否生产环境
+ - IsIDFA:是否使用 IDFA 启动 sdk
+
## 更多
diff --git a/API/Android_detail_api.md b/doc/Android_detail_api.md
similarity index 100%
rename from API/Android_detail_api.md
rename to doc/Android_detail_api.md
diff --git a/API/Android_handle_install.md b/doc/Android_handle_install.md
similarity index 100%
rename from API/Android_handle_install.md
rename to doc/Android_handle_install.md
diff --git a/API/Common_detail_api.md b/doc/Common_detail_api.md
similarity index 100%
rename from API/Common_detail_api.md
rename to doc/Common_detail_api.md
diff --git a/API/iOS API.md b/doc/iOS_API.md
similarity index 100%
rename from API/iOS API.md
rename to doc/iOS_API.md
diff --git a/doc/iOS_install.md b/doc/iOS_install.md
new file mode 100644
index 0000000..6a58f5c
--- /dev/null
+++ b/doc/iOS_install.md
@@ -0,0 +1,35 @@
+## iOS 手动安装
+
+- 下载 JPush PhoneGap Plugin 插件,并解压
+
+- 将 [/src/ios](/src/ios) 文件夹及内容在 xcode 中拖到你的工程里,并配置 [/src/ios/PushConfig.plist](/src/ios/PushConfig.plist) 中相应参数:
+
+ APP_KEY: 应用标识
+ CHANNEL: 渠道标识
+ IsProduction:是否生产环境
+ IsIDFA: 是否使用 IDFA 启动 sdk
+
+- 打开 xcode,点击工程目录中顶部的 工程,选择(Target -> Build Phases -> Link Binary With Libraries),添加以下框架:
+
+ CFNetwork.framework
+ CoreFoundation.framework
+ CoreTelephony.framework
+ SystemConfiguration.framework
+ CoreGraphics.framework
+ Foundation.framework
+ UIKit.framework
+ AdSupport.framework
+ libz.tbd(若存在 libz.dylib 则替换为 libz.tbd)
+
+- 修改 phonegap config.xml 文件以添加 JPushPlugin 插件
+
+
+
+
+
+
+- 将 [/www/JPushPlugin.js](/www/JPushPlugin.js) 在 xcode 中拖到工程的 www 目录下面
+
+- 在需要使用插件处加入以下代码,并根据 [iOS API](/doc/iOS_API.md) 文档说明调用相应接口
+
+
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..c83c180 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..ec4917b 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