mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-20 20:22:50 +08:00
iOS - update
1.更新目录 2.更新 README.md 3.重写 iOS_install.md
This commit is contained in:
parent
79fb3b76ca
commit
aa3a4a218c
@ -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>
|
31
README.md
31
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
|
||||
|
||||
|
||||
|
||||
## 更多
|
||||
|
35
doc/iOS_install.md
Normal file
35
doc/iOS_install.md
Normal 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>
|
@ -14,7 +14,7 @@
|
||||
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 JP_APP_ISIDFA = @"IsIDFA";
|
||||
static NSString *const JPushConfigFileName = @"PushConfig";
|
||||
static NSDictionary *_luanchOptions = nil;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
<string>Subscription</string>
|
||||
<key>IsProduction</key>
|
||||
<false/>
|
||||
<key>isIDFA</key>
|
||||
<key>IsIDFA</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Loading…
Reference in New Issue
Block a user