iOS - update

1.更新 iOS sdk
2.更改启动 sdk 的方法
3.PushConfig.plist 添加 isIDFA 字段
This commit is contained in:
E.B 2016-04-26 14:02:27 +08:00
parent 76b3014417
commit 79fb3b76ca
5 changed files with 38 additions and 15 deletions

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
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;