小编kcm*_*fat的帖子

Firebase - 将匿名用户转换为登录用户?

背景:在我的iOS游戏中,我想允许用户在不登录的情况下进行游戏(在Firebase中匿名进行身份验证以保存用户数据),还可以让他们选择使用Facebook登录以解锁其他游戏玩法.

我正在尝试修改此帖子,用匿名登录替换Twitter登录:

"users": {
    "$userid": {
      // Require the user to be logged in, and make sure their current credentials
      // match at least one of the credentials listed below, unless we're creating
      // a new account from scratch.
      ".write": "auth != null && 
        (data.val() === null || 
        (auth.provider === 'facebook' && auth.uid === data.child('facebook/id').val() || 
        (auth.provider === 'anonymous' && auth.uid === data.child('anonymous/id').val()))"
    }
  }
Run Code Online (Sandbox Code Playgroud)

我很困惑转换将如何与这些规则一起使用.特别是说:

  1. 用户匿名进行身份验证,并且能够创建存储在其下的匿名uid的规范用户记录users/"$userid"/anonymous/id.这是允许的,因为用户已通过身份验证并且第一次设置了用户对象(auth != null && data.val() === null).

  2. users/"$userid"/ …

authentication facebook anonymous-users firebase

6
推荐指数
0
解决办法
1307
查看次数

解析 iOS 单元测试 PFUser 的子类

我正在尝试对 PFObject 子类的子类进行单元测试(使用 XCTest),但是我收到了所有此类子类的警告,这些子类是测试目标的一部分:

Class MySubclassOfSubclassOfPFObject is implemented in both /var/mobile/Containers/Bundle/Application/84C7811F-348E-42EF-9FF4-F243DB669591/MyApp.app/MyApp and /var/mobile/Containers/Data/Application/A84479A8-1ACD-4F7B-B02D-A28CB412CD14/tmp/MyAppTests.xctest/MyAppTests. One of the two will be used. Which one is undefined.
Run Code Online (Sandbox Code Playgroud)

我的 PFUser 子类也出现异常:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Tried to register both ParseUser and ParseUser as the native PFObject subclass of _User. Cannot determine the right class to use because neither inherits from the other.'
Run Code Online (Sandbox Code Playgroud)

我已经通过 cocoapods 安装了 Parse 1.12 并运行了 XCode 7.2。

我的 podfile 看起来像这样:

target 'Watchi' do
use_frameworks!
pod 'Parse' …
Run Code Online (Sandbox Code Playgroud)

unit-testing objective-c ios parse-platform pfobject

5
推荐指数
0
解决办法
144
查看次数