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

标签 ios iphone unity-game-engine 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) 

最佳答案

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

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

关于ios - Unity Facebook 插件在登录后终止应用程序(iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41082304/

相关文章:

ios - 为什么 iOS 模拟器只显示一个空白 View /窗口?

iphone - 如何在核心数据中保存单个实体

c# - 恢复生命值不会改变玩家的统计数据

iphone - 将 iTunes 中的图像同步到 iPhone 模拟器

ios - iOS 上的启动画面有问题?

javascript - 统一/如何设置敌人生成的限制?

ios - 如何以编程方式在 iOS 上创建和拨号 VPN 连接?

iphone - beginAnimations 和 using animations block 之间的动画速度不同

具有深度链接的 iOS 9 搜索功能

ios - 完成 block 完成后返回一个数组