我尝试使用parse(iOS sdk v1.6.0)和with switch并遵循我制作的文档:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
Parse.enableLocalDatastore()
Parse.setApplicationId("appKey", clientKey:"clientKey")
但是启动应用程序我有这个错误:
2014-12-11 20:29:41.627 ShareTales[62985:626799] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You have to call setApplicationId:clientKey: on Parse to configure Parse.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000104873f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104163bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000104873e6d +[NSException raise:format:] + 205
3 ShareTales 0x00000001027ce7ba +[Parse getApplicationId] + 53
4 ShareTales 0x00000001027b3140 +[PFInternalUtils dataFilePath:] + 53
5 ShareTales 0x00000001027515ff -[PFSQLiteDatabase initWithName:] + 200
6 ShareTales 0x00000001027517b4 +[PFSQLiteDatabase databaseWithName:] + 69
7 ShareTales 0x0000000102766e79 +[PFOfflineStore _initializeTables] + 58
8 libdispatch.dylib 0x00000001064a07f4 _dispatch_client_callout + 8
9 libdispatch.dylib 0x000000010648d343 dispatch_once_f + 565
10 ShareTales 0x000000010275d6ef +[PFOfflineStore enableOfflineStore] + 252
11 ShareTales 0x00000001026f4c0d _TFC10ShareTales11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 157
12 ShareTales 0x00000001026f5d30 _TToFC10ShareTales11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 560
13 UIKit 0x0000000104c5b475 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 234
14 UIKit 0x0000000104c5bfbc -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2463
15 UIKit 0x0000000104c5ed2c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350
16 UIKit 0x0000000104c5dbf2 -[UIApplication workspaceDidEndTransaction:] + 179
17 FrontBoardServices 0x000000010c5602a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
18 CoreFoundation 0x00000001047a953c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
19 CoreFoundation 0x000000010479f285 __CFRunLoopDoBlocks + 341
20 CoreFoundation 0x000000010479f045 __CFRunLoopRun + 2389
21 CoreFoundation 0x000000010479e486 CFRunLoopRunSpecific + 470
22 UIKit 0x0000000104c5d669 -[UIApplication _run] + 413
23 UIKit 0x0000000104c60420 UIApplicationMain + 1282
24 ShareTales 0x00000001026f8d8e top_level_code + 78
25 ShareTales 0x00000001026f8dca main + 42
26 libdyld.dylib 0x00000001064d5145 start + 1
有什么建议吗?
我还尝试在Parse.setApplicationId
之后移动它func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
Parse.enableLocalDatastore()
Parse.setApplicationId("appKey", clientKey:"clientKey")
我有:
2014-12-11 20:38:28.118 ShareTales[67520:637437] Warning: A long-running operation is being executed on the main thread.
Break on warnBlockingOperationOnMainThread() to debug.
答案 0 :(得分:1)
我将[Parse enableLocalDatastore];
放在[Parse setApplicationId:clientKey:];
之后,我又遇到了其他错误。但另一个错误是因为您无法一起使用本地数据存储区和缓存策略。当我删除缓存策略的方法时一切正常。所以,我不知道这是否是文档错误,但您必须将此代码放在之后。
答案 1 :(得分:0)
此错误有时是由iOS项目模板中不兼容的链接器标志引起的。
要清除错误,请转到Xcode中的项目构建设置,然后修改您的"其他链接标记"设定:
1。)删除" -weak_library /usr/lib/libSystem.B.dylib" 2.)添加" -weak-lSystem"