SetUserId Unity iOS Firebase Analytics

时间:2017-09-06 19:20:27

标签: ios firebase unity3d firebase-analytics

firebase documentation for SetUserId中,它声称Setting userId to NULL or nullptr removes the user ID.但是当我这样做时,我得到一个异常,表明不允许使用空字符串。

我的问题:

  1. 我是否错误地解释了文档?是不允许空的?
  2. 如果不允许null(或者如果这是firebase的错误),我该如何解决它?如何删除用户ID?
  3. 我调用SetUserId的行:

    FirebaseAnalytics.SetUserId(Authentication.IsAuthenticated ? Social.localUser.id : null);
    

    堆栈跟踪:

    2017-09-06 11:49:49.288 SunBlocks[10837:4796100] Uncaught exception: NSInvalidArgumentException: *** +[NSString stringWithUTF8String:]: NULL cString
    (
        0   CoreFoundation                      0x260ad0ef <redacted> + 150
        1   libobjc.A.dylib                     0x347ecc77 objc_exception_throw + 38
        2   CoreFoundation                      0x260ad01d <redacted> + 0
        3   Foundation                          0x26d1e78d <redacted> + 76
        4   SunBlocks                           0x016997bf _ZN8firebase9analytics9SetUserIdEPKc + 70
        5   SunBlocks                           0x00158a07 FirebaseAnalyticsPINVOKE_Firebase_Analytics_SetUserId_m547785349 + 30
        6   SunBlocks                           0x00158927 FirebaseAnalytics_SetUserId_m3682502317 + 148
        7   SunBlocks                           0x001065c5 FirebaseManager_OnAuthenticationPrepare_m4075942421 + 304
        8   SunBlocks                           0x002a28f1 EventHandler_1_Invoke_m768111117_gshared + 284
        9   SunBlocks                           0x000fe955 Authentication_raisePrepared_m1695901771 + 744
        10  SunBlocks                           0x000feb75 Authentication_OnAuthenticate_m3209094272 + 320
        11  SunBlocks                           0x0019ef6b Action_2_Invoke_m744924674_gshared + 284
        12  SunBlocks                           0x005ad617 GameCenterPlatform_AuthenticateCallbackWrapper_m2107931883 + 396
        13  SunBlocks                           0x00953da9 _Z62RuntimeInvoker_Void_t3468369357_Int32_t620045365_RuntimeObjectPFvvEPK10MethodInfoPvPS4_ + 48
        14  SunBlocks                           0x0168535b _ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException + 118
        15  SunBlocks                           0x010337d3 _Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb + 62
        16  SunBlocks                           0x010300c5 _ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb + 86
        17  SunBlocks                           0x0122e0bd _Z24InvokeGameCenterCallbackPKcRK18ScriptingArguments + 144
        18  SunBlocks                           0x0122e18d _ZN10GameCenter26ExecuteGameCenterCallbacksEv + 118
        19  SunBlocks                           0x012272f9 _ZZL27InitializeModule_GameCentervEN51PostLateUpdateExecuteGameCenterCallbacksRegistrator7ForwardEv + 104
        20  SunBlocks                           0x00f15177 _Z10PlayerLoopv + 1710
        21  SunBlocks                           0x012355f7 _ZL19UnityPlayerLoopImplb + 32
        22  SunBlocks                           0x000ccaed UnityRepaint + 124
        23  SunBlocks                           0x000cca6d -[UnityAppController(Rendering) repaint] + 106
        24  SunBlocks                           0x000cc99d -[UnityAppController(Rendering) repaintDisplayLink] + 120
        25  libMTLInterpose.dylib               0x042dcd2b -[DYDisplayLinkInterposer forwardDisplayLinkCallback:] + 274
        26  QuartzCore                          0x2916fb67 <redacted> + 98
        27  QuartzCore                          0x2916f9cf <redacted> + 366
        28  IOMobileFramebuffer                 0x2df0fc03 <redacted> + 90
        29  IOKit                               0x27027d0d IODispatchCalloutFromCFMessage + 256
        30  CoreFoundation                      0x26062335 <redacted> + 132
        31  CoreFoundation                      0x2607282b <redacted> + 34
        32  CoreFoundation                      0x260727c7 <redacted> + 346
        33  CoreFoundation                      0x26070de9 <redacted> + 1608
        34  CoreFoundation                      0x25fbc6d1 CFRunLoopRunSpecific + 476
        35  CoreFoundation                      0x25fbc4e3 CFRunLoopRunInMode + 106
        36  GraphicsServices                    0x2d9581a9 GSEventRunModal + 136
        37  UIKit                               0x2976e445 UIApplicationMain + 1440
        38  SunBlocks                           0x000c070b main + 250
        39  libdyld.dylib                       0x34dbaaaf <redacted> + 2
    )
    2017-09-06 11:49:49.295 SunBlocks[10837:4796100] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString'
    

0 个答案:

没有答案