当前位置: 首页 > news >正文

深圳服装网站建设制作开发wordpress编辑远程图片大小

深圳服装网站建设制作开发,wordpress编辑远程图片大小,Wordpress媒体库途径,用商标做网站名字此次即友盟分享小结(友盟分享小结 - iOS)之后对推送也进行了一版优化.此次分享内容依然基于已经成功集成 SDK 后 code 层级部分. 注:此次分享基于 SDK 3.1.0,若版本相差较大,仅供参考. 极光推送官方文档: https://docs.jiguang.cn/jpush/guideline/intro/ 首先,为分享单独创建了…此次即友盟分享小结(友盟分享小结 - iOS)之后对推送也进行了一版优化.此次分享内容依然基于已经成功集成 SDK 后 code 层级部分. 注:此次分享基于 SDK 3.1.0,若版本相差较大,仅供参考. 极光推送官方文档: https://docs.jiguang.cn/jpush/guideline/intro/   首先,为分享单独创建了一个类,为了可以更加清晰的划分其内容部分. 注:创建该子类后,切记将其头文件引入到 AppDelegate 类中. #import AppDelegate.h // Push #import AppDelegateJPush.h其次,将项目工程中配置相关配置.   最后,便是具体 code 相关内容,将申请的相关 key 预先设置成宏准备好,方便使用和变更时进行调用和更改. 一.声明 优先将初始化的相关接口配置声明准备好. #import AppDelegate.hinterface AppDelegate (JPush)/**JPush 注册param launchOptions 启动项*/ - (void)registerJPush:(NSDictionary *)launchOptions;end将子类中声明的方法在 AppDelegate 的方法中调用. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// Override point for customization after application launch.// UserDefaults 相关[[DZSBUserInfo sharedInstance] loadCacheData];// CoreData 相关[[CoreDataManager sharedCoreDataManager] managedObjectContext];// 友盟相关[self umAssociatedDetailSettings];// Push[self registerJPush:launchOptions];// Root VC[self setRootViewController];return YES; }二.实现 1.引入所需的头文件2.实现声明类中接口3.实现具体方法和代理事件 #import AppDelegateJPush.h #import JPUSHService.h // iOS10注册APNs所需头文件 #ifdef NSFoundationVersionNumber_iOS_9_x_Max #import UserNotifications/UserNotifications.h #endif // 如果需要使用idfa功能所需要引入的头文件可选 #import AdSupport/AdSupport.hstatic NSString *appKey JPush_APPKEY; static NSString *channel JPush_CHANNEL;// AppStore static BOOL isProduction FALSE;interface AppDelegate () JPUSHRegisterDelegateendimplementation AppDelegate (JPush)- (void)registerJPush:(NSDictionary *)launchOptions {//Required//notice: 3.0.0及以后版本注册可以这样写也可以继续用之前的注册方式JPUSHRegisterEntity * entity [[JPUSHRegisterEntity alloc] init];entity.types JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSound;if ([[UIDevice currentDevice].systemVersion floatValue] 8.0) {// 可以添加自定义categories// NSSetUNNotificationCategory * *categories for iOS10 or later// NSSetUIUserNotificationCategory * *categories for iOS8 and iOS9}[JPUSHService registerForRemoteNotificationConfig:entity delegate:self];// 注册// apn 内容获取 // NSDictionary *remoteNotification [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];// 监听自定义消息[kNotificationCenter addObserver:selfselector:selector(networkDidReceiveMessage:)name:kJPFNetworkDidReceiveMessageNotificationobject:nil];// Optional// 获取IDFA// 如需使用IDFA功能请添加此代码并在初始化方法的advertisingIdentifier参数中填写对应值NSString *advertisingId [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];// Required// init Push// notice: 2.1.5版本的SDK新增的注册方法改成可上报IDFA如果没有使用IDFA直接传nil// 如需继续使用pushConfig.plist文件声明appKey等配置内容请依旧使用[JPUSHService setupWithOption:launchOptions]方式初始化。 // [JPUSHService setupWithOption:launchOptions // appKey:appKey // channel:channel // apsForProduction:isProduction];[JPUSHService setupWithOption:launchOptionsappKey:appKeychannel:channelapsForProduction:isProductionadvertisingIdentifier:nil];[JPUSHService registrationIDCompletionHandler:^(int resCode, NSString *registrationID) {NSLog(JPush --- resCode : %d,registrationID: %,resCode,registrationID);// [JPUSHService setDebugMode];[JPUSHService setLogOFF];// 生成环境调用}]; }/**获取自定义消息推送内容content获取推送的内容messageID获取推送的messageID(key为_j_msgid)extras获取用户自定义参数customizeField1根据自定义key获取自定义的valueparam notification 结构体*/ - (void)networkDidReceiveMessage:(NSNotification *)notification {/*接收消息样式{content \U7529\U9505\U7ed9IOS\Uff01;extras {fFunPageUrl www.baidu.com;fType 2;};title \U6d4b\U8bd5;}*/NSDictionary * userInfo [notification userInfo];/** 消息标题*/NSString *content [userInfo valueForKey:content];/** 消息内容*/NSDictionary *extras [userInfo valueForKey:extras];NSString *messageID [userInfo valueForKey:_j_msgid];NSString *customizeField1 [extras valueForKey:customizeField1]; //服务端传递的Extras附加字段key是自己定义的}#pragma mark - Delegate /**Required - 注册 DeviceToken注:JPush 3.0.9 之前的版本必须调用此接口注册 token 之后才可以登录极光使用通知和自定义消息功能。从 JPush 3.0.9 版本开始不调用此方法也可以登录极光。但是不能使用APNs通知功能只可以使用JPush自定义消息。param application 应用param deviceToken 标识*/ - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {[JPUSHService registerDeviceToken:deviceToken]; }- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {// Required,For systems with less than or equal to iOS6// 取得 APNs 标准信息内容NSDictionary *aps [userInfo valueForKey:aps];NSString *content [aps valueForKey:alert]; //推送显示的内容NSInteger badge [[aps valueForKey:badge] integerValue]; //badge数量NSString *sound [aps valueForKey:sound]; //播放的声音// 取得Extras字段内容NSString *customizeField1 [userInfo valueForKey:customizeExtras]; //服务端中Extras字段key是自己定义的NSLog(JPush\ncontent [%], badge[%ld], sound[%], customize field [%],content,(long)badge,sound,customizeField1);[JPUSHService handleRemoteNotification:userInfo];NSLog(JPush - Receive notice\n%, userInfo);// iOS badge 清0application.applicationIconBadgeNumber 0; }- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {// Required, iOS 7 Support[JPUSHService handleRemoteNotification:userInfo];// 应用正处理前台状态下不会收到推送消息因此在此处需要额外处理一下if (application.applicationState UIApplicationStateActive) {UIAlertView *alert [[UIAlertView alloc]initWithTitle:收到推送消息message:userInfo[aps][alert]delegate:nilcancelButtonTitle:取消otherButtonTitles:确定,nil];[alert show];}NSLog(JPush - Receive notice\n%, userInfo);// 收到通知处理相关事项 contentType(系统消息 系统公告NSString *contentType [NSString stringWithFormat:%, [userInfo objectForKey:contentType]];// 消息集合NSMutableDictionary *dicMessage [[NSMutableDictionary alloc] init];if ([contentType isEqualToString:]) {//系统消息// do somethings} else if ([contentType isEqualToString:]){//系统公告// do somethings}// block 回调completionHandler(UIBackgroundFetchResultNewData); }/**注册 APNs 失败param application 应用param error 异常*/ - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(nonnull NSError *)error {//OptionalNSLog(JPush --- did Fail To Register For Remote Notifications With Error: %\nLocalizedDescription: %, error, error.localizedDescription); }#pragma mark- JPUSHRegisterDelegate // iOS 10 Support - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler API_AVAILABLE(ios(10.0)){// RequiredNSDictionary * userInfo notification.request.content.userInfo;if (available(iOS 10.0, *)) {if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {[JPUSHService handleRemoteNotification:userInfo];}} else {// Fallback on earlier versions}if (available(iOS 10.0, *)) {completionHandler(UNNotificationPresentationOptionAlert);// 需要执行这个方法选择是否提醒用户有Badge、Sound、Alert三种类型可以选择设置} else {// Fallback on earlier versions} }// iOS 10 Support - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0)){// RequiredNSDictionary * userInfo response.notification.request.content.userInfo;if (available(iOS 10.0, *)) {if([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {[JPUSHService handleRemoteNotification:userInfo];}} else {// Fallback on earlier versions}completionHandler(); // 系统要求执行这个方法 }end 注:以上实现部分所分享的内容是针对集成后的基本对接部分,其中不包含接收消息后的具体业务逻辑,具体业务逻辑需要根据产品需求在代理回调部分进行单独自行定制开发.    分享内容中可能存在的缩写内容部分 code 如下: #pragma mark - 缩写 #define kApplication [UIApplication sharedApplication] #define kKeyWindow [UIApplication sharedApplication].keyWindow #define kAppDelegate ((AppDelegate*)[UIApplication sharedApplication].delegate) #define kUserDefaults [NSUserDefaults standardUserDefaults] #define kNotificationCenter [NSNotificationCenter defaultCenter]以上便是此次分享的全部内容,较为简易的推送小结,具体还以实际需求为准,可以自行 diy 调整,希望对大家有所帮助,也希望大神多多指点共进步!  转载于:https://www.cnblogs.com/survivorsfyh/p/9718602.html
http://www.zqtcl.cn/news/366482/

相关文章:

  • 网站域名的后缀wordpress文章归类
  • 查询企业信息的官方网站大连建设网站公司
  • 网站建设 全包专业建设规划方案模板
  • 做网站好还是做微信小程序好浙江建设工程造价信息网站
  • 网站开发怎么报价推广普通话手抄报模板可打印
  • 好的平面网站模板企业网站建设浩森宇特
  • 做网站通过什么赚钱吗公司建设网站的费用
  • 如何做建筑一体化的网站视频网站开发应用到哪些技术
  • 巴中微信网站建设竞价托管一般多少钱
  • 彩票网站开发 违法股票网站排名哪个好
  • 宝格丽网站建设哈尔滨网站建设王道下拉強
  • 烟台网站建设的公司世界500强企业排名2021
  • 网络营销做得比较成功的案例吴中seo网站优化软件
  • 怎么设立网站美区下载的app怎么更新
  • 建立网站ppt做酒店网站所用到的算法
  • 上海网站建设的价格低太仓做网站的公司
  • 怎样登录建设互联网站怎么做中英文网站
  • 云网站7china中小企业网站建设好么
  • 美丽南方官网网站建设国际新闻最新消息今天摘抄
  • 牛商网营销型网站多少钱江门营销型网站建设多少钱
  • 小榄公司网站建设网站交互做的比较好的
  • 深圳定制网站建设怎么改版网站
  • 免费学软件的自学网站江阴建设局网站
  • 网站做多久苍南县网站集约化建设
  • 深圳电子烟网站建设罗湖建设公司网站建设
  • 酒店 深圳 网站建设新项目首码对接平台
  • 岳阳市住房和城乡建设局网站上海专业网站建设网
  • 营销型网站建设设定包括哪些方面网站建设后的心得
  • 建立网站来网上销售的英文潢川城乡建设局网站
  • 仿站建站教程网站怎么接广告