2015-03-30 76 views
-1

我搜索了一個答案,發現很多,但沒有任何工作對我來說,在修復我的錯誤和大多數的答案告訴我刪除與黃色感嘆號的項目,但我找不到任何。應用程序失敗iOS7.1 - 由於未捕獲的異常'NSInvalidArgumentException'

我的版本在運行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

您可以在您的應用程序代理中顯示註冊遠程通知設備的代碼嗎? – jimrice 2015-03-30 20:35:58

+0

[RegisterUserNotificationSettings可能重複在ios 6.1中不起作用](http://stackoverflow.com/questions/27294281/registerusernotificationsettings-is-not-working-in-ios-6-1) – Almo 2015-03-30 20:40:05

+0

重複;這在其他地方已有介紹,並且有工作代碼的答案,可以在iOS 7或更低版​​本或iOS 8上運行。 – Almo 2015-03-30 20:40:33

回答

0

從蘋果官方文檔

可用性

可提供的iOS 8.0及更高版本。 這個registerUserNotificationSettings方法使用不能用於ios7。

更新1

也許你可以使用

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; 

代替registerUserNotificationSettings

3

按照蘋果的文檔,registerUserNotificationSettings僅在iOS 8的和更大的可用。如果您想要支持較早版本的iOS,您必須以其他方式實現此功能。

相關問題