Unity Facebook Plugin terminates app after login (iOS)

Question

I am trying to login Facebook from my Unity3D project. I use my iPhone 6 to test it. Everything works well in the game but after login is done to facebook, the game cannot come to foreground again and it terminates. XCode brings below code to screen. The part UIApplicationMain(argc... is marked and it says 'thread 1: signal SIGABRT'

Please help I spent hours but could not spot the problem.

// 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;

This is the output:

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) 

Show source
| ios   | iphone   | unity3d   | facebook-login   | xcode8   2016-12-11 03:12 1 Answers

Answers to Unity Facebook Plugin terminates app after login (iOS) ( 1 )

  1. 2016-12-11 11:12

    After a long search I've found the solution where I should have looked first. See this to solve it:

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

Leave a reply to - Unity Facebook Plugin terminates app after login (iOS)

◀ Go back