<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 6 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 6 年前。
我需要同时支持 iOS 9 和 10 的推送通知。我该怎么做 ?我正在寻找一些想法。我使用了 UserNotificationsUI.framework。但它在 iOS 9 中崩溃。
最佳答案
既是新旧框架
如果您使用以下命令区分 SDK“iOS 10.0”(Xcode 8) 和 SDK“iOS 9.0”,您会发现 SDK“iOS 10.0”(Xcode 8) 中弃用了六个与通知相关的 UIKit 类。
UIKit9Dir="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/UIKit.framework" UIKit10Dir="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/UIKit.framework"
OptIgnore=--ignore-matching-lines='//.版权所有' DIFFBIN=/usr/bin/差异 $DIFFBIN -U 1 -r -x '.tbd' -x '.modulemap' $OptIgnore $UIKit9Dir $UIKit10Dir|egrep -C 1 "NS_CLASS_DEPRECATED_IOS."|grep 接口(interface)
在工作的同时实现了这两种方法
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
/// schedule localNotification, the delegate must be set before the application returns from applicationDidFinishLaunching:.
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
} else {
UILocalNotification *localNotifacation = [self getLocalNotificationFromLaunchOptions:launchOptions];
if (localNotifacation) {
NSString *title = localNotifacation.alertBody;
[self addLabel:title];
}
}
然后实现您需要的任何远程通知方法。
关于ios - objective-c 中 ios 9 的 UserNotificationsUI.framework 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40946071/