gpt4 book ai didi

ios - Firebase 简单登录错误 "__NSPlaceholderDictionary initWithObjects:forKeys:count:"

转载 作者:行者123 更新时间:2023-11-28 22:07:02 29 4
gpt4 key购买 nike

我正在尝试在 iOS 上使用电子邮件和密码进行简单登录。登录时出现以下错误。

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]' * First throw call stack: ( 0 CoreFoundation 0x02eee1e4 exceptionPreprocess + 180 1 libobjc.A.dylib
0x02c6d8e5 objc_exception_throw + 44 2 CoreFoundation
0x02eb4376 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 390 3 CoreFoundation 0x02ee1c29 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 73 4 app 0x000ed30c ParseUserData + 428 5 app
0x0009e6e1 __37-[MenuViewController checkAuthStatus]_block_invoke + 161 6 app 0x0011f89f __82-[FirebaseSimpleLogin attemptAuthWithToken:provider:userData:account:andCallback:]_block_invoke + 461 7 app 0x00199df7 __43-[FRepo callOnComplete:withStatus:andData:]_block_invoke + 33 8
libdispatch.dylib 0x06e457b8 _dispatch_call_block_and_release + 15 9 libdispatch.dylib 0x06e5a4d0 _dispatch_client_callout + 14 10 libdispatch.dylib
0x06e48726 _dispatch_main_queue_callback_4CF + 340 11 CoreFoundation 0x02f5343e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
+ 14 12 CoreFoundation 0x02e945cb __CFRunLoopRun + 1963 13 CoreFoundation 0x02e939d3 CFRunLoopRunSpecific + 467 14 CoreFoundation
0x02e937eb CFRunLoopRunInMode + 123 15 GraphicsServices
0x03d535ee GSEventRunModal + 192 16 GraphicsServices
0x03d5342b GSEventRun + 104 17 UIKit
0x0192df9b UIApplicationMain + 1225 18 app
0x0010623d main + 141 19 libdyld.dylib
0x0708f701 start + 1 20 ???
0x00000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

我的代码:

Firebase *ref = [[Firebase alloc] initWithUrl:FIREBASE];
FirebaseSimpleLogin *authClient = [[FirebaseSimpleLogin alloc] initWithRef:ref];

[authClient loginWithEmail:@"useremail" andPassword:@"userPassword"
withCompletionBlock:^(NSError* error, FAUser* user) {

if (error != nil) {
NSLog(@"Success!");
// There was an error logging in to this account

} else {
NSString *message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
if (message == nil) message = @"Please try again";
[self performSelectorOnMainThread:@selector(showError:) withObject:message waitUntilDone:NO];
}
}];

收到此错误,我的应用程序不再从数据库中获取数据并崩溃。有人知道吗?

最佳答案

查看堆栈跟踪。错误出在您未显示的方法 ParseUserData 中。在该方法中,您试图创建一个字典,但您传入的第一个对象是零。

在 Xcode 中,设置一个在抛出异常时触发的断点,这样下次您可以检查正在运行的程序发生了什么。

关于ios - Firebase 简单登录错误 "__NSPlaceholderDictionary initWithObjects:forKeys:count:",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23708461/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com