Merge branch 'dev'

This commit is contained in:
E.B 2016-04-27 10:37:30 +08:00
commit 6409ce4934
12 changed files with 88 additions and 93 deletions

View File

@ -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/ 内的插件
<feature name="JPushPlugin">
<param name="ios-package" value="JPushPlugin" />
<param name="onload" value="true" />
</feature>
- 复制 `$JPUSH_PLUGIN_DIR`/www/JPushPlugin.js 到工程的 www 目录下面
- 在需要使用插件处加入
<script type="text/javascript" src="JPushPlugin.js"></script>

View File

@ -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
## 更多

35
doc/iOS_install.md Normal file
View File

@ -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 插件
<feature name="JPushPlugin">
<param name="ios-package" value="JPushPlugin" />
<param name="onload" value="true" />
</feature>
- 将 [/www/JPushPlugin.js](/www/JPushPlugin.js) 在 xcode 中拖到工程的 www 目录下面
- 在需要使用插件处加入以下代码,并根据 [iOS API](/doc/iOS_API.md) 文档说明调用相应接口
<script type="text/javascript" src="JPushPlugin.js"></script>

View File

@ -31,7 +31,7 @@
<source-file src="src/ios/Plugins/JPushPlugin.m"/>
<header-file src="src/ios/lib/JPUSHService.h" />
<source-file src="src/ios/lib/jpush-ios-2.1.0.a" framework="true" />
<source-file src="src/ios/lib/jpush-ios-2.1.6.a" framework="true" />
<header-file src="src/ios/Plugins/AppDelegate+JPush.h"/>
<source-file src="src/ios/Plugins/AppDelegate+JPush.m"/>
<resource-file src="src/ios/PushConfig.plist" />
@ -43,7 +43,8 @@
<framework src="Foundation.framework" weak="true" />
<framework src="UIKit.framework" weak="true" />
<framework src="Security.framework" weak="true" />
<framework src="libz.dylib" weak="true" />
<framework src="libz.tbd" weak="true" />
<framework src="AdSupport.framework" weak="true" />
<config-file target="*PushConfig.plist" parent="APP_KEY">
<string>$API_KEY</string>

View File

@ -9,10 +9,12 @@
#import "JPushPlugin.h"
#import "JPUSHService.h"
#import <UIKit/UIKit.h>
#import <AdSupport/AdSupport.h>
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

View File

@ -8,5 +8,7 @@
<string>Subscription</string>
<key>IsProduction</key>
<false/>
<key>IsIDFA</key>
<true/>
</dict>
</plist>

View File

@ -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 <Foundation/Foundation.h>
@ -51,6 +51,7 @@ extern NSString *const kJPFServiceErrorNotification; // 错误提示
* @param appKey JPush ,. JPush .
* @param channel . .
* @param isProduction . , NO; , YES.
* @param advertisingIdentifier 广IDFA 使IDFAnil.
*
* @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
+ (void)setTags:(NSSet *)tags
alias:(NSString *)alias
fetchCompletionHandle:(void (^)(int iResCode, NSSet *iTags, NSString *iAlias))completionHandler;
fetchCompletionHandle:(void (^)(int iResCode, NSSet *iTags, NSString *iAlias))completionHandler;
+ (void) setTags:(NSSet *)tags
aliasInbackground:(NSString *)alias;