Commit ac3af503 by zhangyunjie

AppDelegate+OffcnIMPush.h

parent 9c7f79da
......@@ -271,6 +271,7 @@
A9D1B64024FE765F000F4662 /* ZYJQNUpToken.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B5F924FE765F000F4662 /* ZYJQNUpToken.m */; };
A9D1B64124FE765F000F4662 /* ZYJQNIP.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B5FC24FE765F000F4662 /* ZYJQNIP.m */; };
A9D1B64224FE765F000F4662 /* ZYJQNSystemTool.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B60224FE765F000F4662 /* ZYJQNSystemTool.m */; };
A9D1B64524FE7D1F000F4662 /* AppDelegate+OffcnIMPush.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B64424FE7D1F000F4662 /* AppDelegate+OffcnIMPush.m */; };
B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49CE5E230A14D9B821170F61 /* libPods-OffcnIMSDKiOS.a */; };
/* End PBXBuildFile section */
......@@ -842,6 +843,8 @@
A9D1B60324FE765F000F4662 /* ZYJQNDnspodEnterprise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYJQNDnspodEnterprise.h; sourceTree = "<group>"; };
A9D1B60424FE765F000F4662 /* ZYJQNInetAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYJQNInetAddress.h; sourceTree = "<group>"; };
A9D1B60524FE765F000F4662 /* ZYJQNUploadInfoReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYJQNUploadInfoReporter.h; sourceTree = "<group>"; };
A9D1B64324FE7D1F000F4662 /* AppDelegate+OffcnIMPush.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+OffcnIMPush.h"; sourceTree = "<group>"; };
A9D1B64424FE7D1F000F4662 /* AppDelegate+OffcnIMPush.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+OffcnIMPush.m"; sourceTree = "<group>"; };
D7DCDED1DEE7F99F223D5C73 /* Pods-OffcnIMSDKiOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OffcnIMSDKiOS.release.xcconfig"; path = "Target Support Files/Pods-OffcnIMSDKiOS/Pods-OffcnIMSDKiOS.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -1651,6 +1654,8 @@
A9D1B32124F50973000F4662 /* OffcnIMModel.m */,
A9661FEE24EA80A50024EB54 /* OffcnIMZYJFMDBHandler.h */,
A9661FF524EA80A50024EB54 /* OffcnIMZYJFMDBHandler.m */,
A9D1B64324FE7D1F000F4662 /* AppDelegate+OffcnIMPush.h */,
A9D1B64424FE7D1F000F4662 /* AppDelegate+OffcnIMPush.m */,
);
path = "ExposedInterface-(外放接口)";
sourceTree = "<group>";
......@@ -2010,6 +2015,7 @@
A966218224EA80A60024EB54 /* ZYJSDWebImagePrefetcher.m in Sources */,
A966216B24EA80A60024EB54 /* ZYJPingHelper.m in Sources */,
A966217324EA80A60024EB54 /* ZYJReachStateWIFI.m in Sources */,
A9D1B64524FE7D1F000F4662 /* AppDelegate+OffcnIMPush.m in Sources */,
A9661B6024EA72900024EB54 /* AppDelegate.m in Sources */,
A96621EC24EA80A60024EB54 /* ZYJAFHTTPSessionManager.m in Sources */,
A966218124EA80A60024EB54 /* NSImage+ZYJWebCache.m in Sources */,
......
......@@ -11,6 +11,7 @@
#import "OffcnIMSDKiOS.h"
#import "OffcnIMSocketManager.h"
#import "OffcnIMZYJFMDBHandler.h"
#import "AppDelegate+OffcnIMPush.h"
@interface AppDelegate ()
......@@ -82,23 +83,6 @@
}
-(void)registerOffcnUserNotificationSettingsWithApplication:(UIApplication *)application options:(NSDictionary *)launchOptions{
// application.applicationIconBadgeNumber = 0;
if ([UIDevice currentDevice].systemVersion.doubleValue >= 8.0){
// 1.请求授权可以给用户发送通知
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeSound | UIUserNotificationTypeBadge | UIUserNotificationTypeAlert categories:nil];
[application registerUserNotificationSettings:settings];
}else{
[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
}
if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]){
// 跳转
}
}
/**
* 远程推送注册成功
*
......@@ -117,19 +101,6 @@
// applicationIconBadgeNumber
}
-(NSString *)hexStringForData:(NSData *)data{
if (data == nil) {
return nil;
}
NSMutableString *hexString = [NSMutableString string];
const unsigned char *p = [data bytes];
for (int i=0; i < [data length]; i++) {
[hexString appendFormat:@"%02x", *p++];
}
return hexString;
}
/**
* 注册失败
......
//
//
// AppDelegate+OffcnIMPush.h
// OffcnIMSDKiOS
//
// Created by vockey on 2020/9/1.
// Copyright © 2020 offcn. All rights reserved.
//
#import "AppDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface AppDelegate (OffcnIMPush)
//注册通知
-(void)registerOffcnUserNotificationSettingsWithApplication:(UIApplication *)application options:(NSDictionary *)launchOptions;
//解析deviceToken
-(NSString *)hexStringForData:(NSData *)data;
@end
NS_ASSUME_NONNULL_END
//
//
// AppDelegate+OffcnIMPush.m
// OffcnIMSDKiOS
//
// Created by vockey on 2020/9/1.
// Copyright © 2020 offcn. All rights reserved.
//
#import "AppDelegate+OffcnIMPush.h"
@implementation AppDelegate (OffcnIMPush)
-(void)registerOffcnUserNotificationSettingsWithApplication:(UIApplication *)application options:(NSDictionary *)launchOptions{
// application.applicationIconBadgeNumber = 0;
if ([UIDevice currentDevice].systemVersion.doubleValue >= 8.0){
// 1.请求授权可以给用户发送通知
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeSound | UIUserNotificationTypeBadge | UIUserNotificationTypeAlert categories:nil];
[application registerUserNotificationSettings:settings];
}else{
[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
}
if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]){
// 跳转
}
}
-(NSString *)hexStringForData:(NSData *)data{
if (data == nil) {
return nil;
}
NSMutableString *hexString = [NSMutableString string];
const unsigned char *p = [data bytes];
for (int i=0; i < [data length]; i++) {
[hexString appendFormat:@"%02x", *p++];
}
return hexString;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment