类名无效。类名不能以下划线IOS开头

时间:2015-03-26 11:42:14

标签: ios

当我成功编译并且应用程序启动时,我收到此错误,3次中有1次:

2015-03-26 12:39:32.294 Cleverly[1689:136981] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid class name. Class names cannot start with an underscore.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000109943a75 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x00000001095dcbb7 objc_exception_throw + 45
    2   CoreFoundation                      0x00000001099439ad +[NSException raise:format:] + 205
    3   Cleverly                            0x0000000104f0f50d +[PFObject(Private) _assertValidInstanceClassName:] + 128
    4   Cleverly                            0x0000000104f0974a -[PFObject(Private) initWithClassName:isPointer:] + 74
    5   Cleverly                            0x0000000104f09b82 +[PFObject(Private) objectWithClassName:isPointer:] + 151
    6   Cleverly                            0x0000000104f17163 +[PFObject objectWithoutDataWithClassName:objectId:] + 158
    7   Cleverly                            0x0000000104f0facf +[PFObject(Private) _objectFromDataFile:error:] + 571
    8   Cleverly                            0x0000000104f66b34 +[PFUser currentUser] + 581
    9   Cleverly                            0x0000000104f2e26d -[PFQuery _user] + 43
    10  Cleverly                            0x0000000104f2e83d -[PFQuery _findObjectsAsync:after:] + 104
    11  Cleverly                            0x0000000104f30860 -[PFQuery findObjectsInBackgroundWithBlock:] + 288
    12  Cleverly                            0x0000000104dc873e -[ServerManager uploadOrDeleteMyUserMissingSyncFiles] + 318
    13  Cleverly                            0x0000000104dce7e6 +[ServerManager uploadOrDeleteMyUserMissingSyncFiles] + 102
    14  Cleverly                            0x0000000104d8d593 __57-[AppDelegate application:didFinishLaunchingWithOptions:]_block_invoke + 35
    15  libdispatch.dylib                   0x0000000109e21186 _dispatch_call_block_and_release + 12
    16  libdispatch.dylib                   0x0000000109e40614 _dispatch_client_callout + 8
    17  libdispatch.dylib                   0x0000000109e2a552 _dispatch_root_queue_drain + 1768
    18  libdispatch.dylib                   0x0000000109e2bb17 _dispatch_worker_thread3 + 111
    19  libsystem_pthread.dylib             0x000000010a1c5637 _pthread_wqthread + 729
    20  libsystem_pthread.dylib             0x000000010a1c340d start_wqthread + 13
)

我认为这与使用CocoaPods添加ParseSDK有关。有任何想法吗?即使它在商店里也会崩溃吗?

1 个答案:

答案 0 :(得分:3)

当您发出异步请求并尝试在完成请求之前使用数据时,会发生这种情况。举例来说,一个加载器可以准确查看异步调用何时完成加载数据。另外,请确保在解析操作的任何调用(例如 PFUser )之前放置/设置解析appid并键入 [Parse setApplicationId:clientKey:] 之前用户)。由于异步未完成加载完整数据,即使在App Store中也会崩溃。我认为这就是你随机获得异常的原因。