Unity Facebook插件登录后终止应用程序(iOS)

时间:2016-12-11 02:08:57

标签: ios iphone unity3d facebook-login xcode8

我正在尝试从Unity3D项目登录Facebook。我用我的iPhone 6来测试它。一切都在游戏中运作良好但在登录完到Facebook后,游戏无法再次出现并终止。 XCode将以下代码带到屏幕上。 UIApplicationMain部分(argc ...已标记,它表示'主题1:信号SIGABRT'

请帮助我花了好几个小时但却找不到问题。

// Hack to work around iOS SDK 4.3 linker problem
// we need at least one __TEXT, __const section entry in main application .o files
// to get this section emitted at right time and so avoid LC_ENCRYPTION_INFO size miscalculation
static const int constsection = 0;

void UnityInitTrampoline();

// WARNING: this MUST be c decl (NSString ctor will be called after +load, so we cant really change its value)
const char* AppControllerClassName = "UnityAppController";

int main(int argc, char* argv[])
{
    @autoreleasepool
    {
        UnityInitTrampoline();
        UnityInitRuntime(argc, argv);

        RegisterMonoModules();
        NSLog(@"-> registered mono modules %p\n", &constsection);
        RegisterFeatures();

        // iOS terminates open sockets when an application enters background mode.
        // The next write to any of such socket causes SIGPIPE signal being raised,
        // even if the request has been done from scripting side. This disables the
        // signal and allows Mono to throw a proper C# exception.
        std::signal(SIGPIPE, SIG_IGN);

        UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String:AppControllerClassName]);
    }

    return 0;

这是输出:

Using Facebook Unity SDK v7.9.0 with FBiOSSDK/4.17.0
Facebook.Unity.CompiledFacebookLoader:Start()

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

FB is now not logged in!
FBScript:SetInit()
Facebook.Unity.CallbackManager:TryCallCallback(Object, IResult)
Facebook.Unity.CallbackManager:CallCallback(Object, IResult)
Facebook.Unity.CallbackManager:OnFacebookResponse(IInternalResult)

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

FB trying to log in!
FBScript:FBlogin()
FBScript:SetInit()
Facebook.Unity.CallbackManager:TryCallCallback(Object, IResult)
Facebook.Unity.CallbackManager:CallCallback(Object, IResult)
Facebook.Unity.CallbackManager:OnFacebookResponse(IInternalResult)

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

2016-12-10 23:44:34.464780 squares[2556:662682] Uncaught exception: NSInvalidArgumentException: *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
(
    0   CoreFoundation                      0x00000001819a61d8 <redacted> + 148
    1   libobjc.A.dylib                     0x00000001803e055c objc_exception_throw + 56
    2   CoreFoundation                      0x0000000181885ad4 CFStringConvertNSStringEncodingToEncoding + 0
    3   squares                             0x00000001000f6e58 -[UnityAppController application:openURL:sourceApplication:annotation:] + 308
    4   UIKit                               0x0000000187a9141c <redacted> + 872
    5   UIKit                               0x0000000187a90e30 <redacted> + 656
    6   SafariServices                      0x000000018fcb28a0 <redacted> + 172
    7   SafariServices                      0x000000018fcaa7c0 <redacted> + 76
    8   CoreFoundation                      0x00000001819ac160 <redacted> + 144
    9   CoreFoundation                      0x000000018189fc3c <redacted> + 284
    10  FrontBoardServices                  0x000000018354d8bc <redacted> + 36
    11  FrontBoardServices                  0x000000018354d728 <redacted> + 176
    12  FrontBoardServices                  0x000000018354dad0 <redacted> + 56
    13  CoreFoundation                      0x0000000181954278 <redacted> + 24
    14  CoreFoundation                      0x0000000181953bc0 <redacted> + 524
    15  CoreFoundation                      0x00000001819517c0 <redacted> + 804
    16  CoreFoundation                      0x0000000181880048 CFRunLoopRunSpecific + 444
    17  GraphicsServices                    0x0000000183306198 GSEventRunModal + 180
    18  UIKit                               0x000000018786c2fc <redacted> + 684
    19  UIKit                               0x0000000187867034 UIApplicationMain + 208
    20  squares                             0x00000001000e300c main + 156
    21  libdyld.dylib                       0x00000001808645b8 <redacted> + 4
)
2016-12-10 23:44:34.465114 squares[2556:662682] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x1819a61c0 0x1803e055c 0x181885ad4 0x1000f6e58 0x187a9141c 0x187a90e30 0x18fcb28a0 0x18fcaa7c0 0x1819ac160 0x18189fc3c 0x18354d8bc 0x18354d728 0x18354dad0 0x181954278 0x181953bc0 0x1819517c0 0x181880048 0x183306198 0x18786c2fc 0x187867034 0x1000e300c 0x1808645b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

1 个答案:

答案 0 :(得分:1)

经过长时间的搜索后,我找到了我应该首先看到的解决方案。看到这个解决它:

https://github.com/facebook/facebook-sdk-for-unity/issues/48