我搜索了一个答案并找到了很多,但没有任何方法可以解决我的错误,大多数答案告诉我删除带有黄色感叹号的项目,但我找不到任何答案。
我的版本在运行iOS8的所有iOS模拟器中运行正常 - 但是一旦我尝试使用iOS7.1,无论选择手机/ ipad,它都会失败。
以下是错误日志:
2015-03-30 14:21:18.839 OpenPatios[26206:f03] Reachability Flag Status: -R -----l- networkStatusForFlags
2015-03-30 14:21:18.866 OpenPatios[26206:f03] Deleted 0 Store item(s)
2015-03-30 14:21:18.873 OpenPatios[26206:f03] Deleted 0 StoreCategory item(s)
2015-03-30 14:21:18.873 OpenPatios[26206:f03] Deleted 0 Photo item(s)
2015-03-30 14:21:18.874 OpenPatios[26206:f03] Deleted 0 Review item(s)
2015-03-30 14:21:18.874 OpenPatios[26206:f03] Deleted 0 Rating item(s)
2015-03-30 14:21:18.875 OpenPatios[26206:f03] Deleted 0 News item(s)
2015-03-30 14:21:18.880 OpenPatios[26206:607] {{0, 0}, {320, 324}}
2015-03-30 14:21:18.899 OpenPatios[26206:607] -[UIApplication registerUserNotificationSettings:]: unrecognized selector sent to instance 0x79714ca0
2015-03-30 14:21:18.901 OpenPatios[26206:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIApplication registerUserNotificationSettings:]: unrecognized selector sent to instance 0x79714ca0'
*** First throw call stack:
(
0 CoreFoundation 0x039501e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x034998e5 objc_exception_throw + 44
2 CoreFoundation 0x039ed243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0394050b ___forwarding___ + 1019
4 CoreFoundation 0x039400ee _CF_forwarding_prep_0 + 14
5 OpenPatios 0x0012ea55 -[AppDelegate application:didFinishLaunchingWithOptions:] + 2053
6 UIKit 0x0257914f -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
7 UIKit 0x02579aa1 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1810
8 UIKit 0x0257e667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
9 UIKit 0x02592f92 -[UIApplication handleEvent:withNewEvent:] + 3517
10 UIKit 0x02593555 -[UIApplication sendEvent:] + 85
11 UIKit 0x02580250 _UIApplicationHandleEvent + 683
12 GraphicsServices 0x05882f02 _PurpleEventCallback + 776
13 GraphicsServices 0x05882a0d PurpleEventCallback + 46
14 CoreFoundation 0x038cbca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
15 CoreFoundation 0x038cb9db __CFRunLoopDoSource1 + 523
16 CoreFoundation 0x038f668c __CFRunLoopRun + 2156
17 CoreFoundation 0x038f59d3 CFRunLoopRunSpecific + 467
18 CoreFoundation 0x038f57eb CFRunLoopRunInMode + 123
19 UIKit 0x0257dd9c -[UIApplication _run] + 840
20 UIKit 0x0257ff9b UIApplicationMain + 1225
21 OpenPatios 0x00162e7d main + 141
22 libdyld.dylib 0x0425f6d9 start + 1
23 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
关于如何解决这个问题的任何明确方向都非常受欢迎,因为我正在了解有关编码的更多信息。
答案 0 :(得分:3)
根据Apple文档,registerUserNotificationSettings仅适用于iOS 8及更高版本。如果你想支持旧版本的iOS,你必须以其他方式实现这一点。
答案 1 :(得分:0)
来自官方Apple文档
状况
适用于iOS 8.0及更高版本。 此registerUserNotificationSettings方法使用不能用于ios7。
更新1
也许你可以使用
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
而不是registerUserNotificationSettings