我使用SimpleLogin和电子邮件/密码认证为现有的Firebase设置了一个非常基本的OSX应用程序。Firebase OSX简单的用电子邮件登录/通过奇数
这是我正在使用的代码。
- (void) applicationDidFinishLaunching:(NSNotification *)notification {
Firebase* ref = [[Firebase alloc] initWithUrl:@"https://myapp.firebaseio.com"];
FirebaseSimpleLogin* authClient = [[FirebaseSimpleLogin alloc] initWithRef:ref];
[authClient loginWithEmail:@"[email protected]" andPassword:@"mypassword"
withCompletionBlock:^(NSError* error, FAUser* user) {
if (error != nil) {
// There was an error logging in to this account
NSLog(@"authClient login error: %@", error);
} else {
NSLog(@"Login success.");
}
}];
}
登录成功,我看到日志输出。但是,“FAUser *用户”是零。怎么样?为什么? 在线搜索/现有的SO问题没有帮助..
任何想法?
**按预期工作中的iOS更新**
相同的代码。这仅仅是一个OSX问题?
**更新2 **
我编译从火力地堡/ Objective-C的简单登录服务(这似乎仅供参考iOS版)的源代码,直接在我的OSX的项目,发现有一当登录服务尝试将钥匙串数据存储在OSX上时出现“重复项”错误代码。
钥匙串保存操作之后的源代码然后继续返回空用户。我相信这是一个逻辑错误在这里,因为如果语句评估为真时,它是不是一个成功的代码(跳过重复项的特殊情况):
if (status != noErr) {
user = nil;
}
else if (status == errSecDuplicateItem) {
// TODO: log an error?
user = nil;
}
反正我能够继续合作,通过修改该一小块代码可以满足我的需求。