ios 13 support
This commit is contained in:
parent
931ec149a6
commit
69312b2402
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cordova-plugin-apns-push",
|
||||
"description": "Register and receive APNS push notifications.",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/NeutrinosPlatform/cordova-plugin-apns-push"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
id="cordova-plugin-apns-push"
|
||||
version="1.0.0">
|
||||
version="1.0.1">
|
||||
|
||||
<name>APNSPushPlugin</name>
|
||||
<description> This plugin allows your application to receive apple push notifications (APNS) on iOS devices. </description>
|
||||
|
@ -340,9 +340,16 @@
|
||||
}
|
||||
NSLog(@"Push Plugin register success: %@", deviceToken);
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
||||
// [deviceToken description] is like "{length = 32, bytes = 0xd3d997af 967d1f43 b405374a 13394d2f ... 28f10282 14af515f }"
|
||||
NSString *token = [self hexadecimalStringFromData:deviceToken];
|
||||
#else
|
||||
// [deviceToken description] is like "<124686a5 556a72ca d808f572 00c323b9 3eff9285 92445590 3225757d b83967be>"
|
||||
NSString *token = [[[[deviceToken description] stringByReplacingOccurrencesOfString:@"<"withString:@""]
|
||||
stringByReplacingOccurrencesOfString:@">" withString:@""]
|
||||
stringByReplacingOccurrencesOfString: @" " withString: @""];
|
||||
#endif
|
||||
|
||||
#if !TARGET_IPHONE_SIMULATOR
|
||||
|
||||
// Check what Notifications the user has turned on. We registered for all three, but they may have manually disabled some or all of them.
|
||||
@ -360,6 +367,21 @@
|
||||
#endif
|
||||
}
|
||||
|
||||
- (NSString *)hexadecimalStringFromData:(NSData *)data
|
||||
{
|
||||
NSUInteger dataLength = data.length;
|
||||
if (dataLength == 0) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
const unsigned char *dataBuffer = data.bytes;
|
||||
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
|
||||
for (int i = 0; i < dataLength; ++i) {
|
||||
[hexString appendFormat:@"%02x", dataBuffer[i]];
|
||||
}
|
||||
return [hexString copy];
|
||||
}
|
||||
|
||||
- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
|
||||
{
|
||||
if (self.callbackId == nil) {
|
||||
|
Loading…
Reference in New Issue
Block a user