erre
erre

Reputation: 49

OneSignal Unity iOS crash on startup

I started working on a project that was built using OneSignal v1.15.2.

On Android everything works fine. On iOS instead, I tried to follow this: https://documentation.onesignal.com/v3.0/docs/unity-sdk-setup (points [5.1 - 5.7]: they just add UserNotifications.framework)

Now, if I launch my application it crashes and the message is: "dyld: image not found". If I remove UserNotifications.framework the all game runs ok but notifications.

Is the current version of OneSignal so different from the past? Is there another setup process guide that I should follow?

I'm using Unity 5.3.1p4 and XCode 8.2.1 (I was using XCode 8.3.1 and notifications worked well, but this newer version have some documented incompatibility with Unity 5.3.1p4).

Can anyone help me?

Thank you.

Best regard, Andrea.

Upvotes: 1

Views: 738

Answers (1)

colinday
colinday

Reputation: 101

For what it's worth I'm using Unity 5.6.0 and Xcode 8.3.2 with the SDK Unity5OneSignalSDK.unitypackage and points 5.1 through 5.7 where sufficient to get push notifications working.

I am also automating the background modes to check "remote-notifications" using the following post processor ... I can't find a way to automate the link with UserNotifications.framework yet tho ... let me know if anybody has ideas on how to do that.

// ---------------------------------------------------------------------------------------------------------------------
public static class XCodePostProcess
{

    // -----------------------------------------------------------------------------------------------------------------
    [PostProcessBuild(100)]
    public static void OnPostprocessBuild( BuildTarget target, string pathToBuildProject )
    {
        if (target == BuildTarget.iOS)
        {
            UpdateInfoPlist( pathToBuildProject );
        }
    }

    // -----------------------------------------------------------------------------------------------------------------
    private static void UpdateInfoPlist( string path )
    {

        // load plist
        string plistPath = Path.Combine( path, "Info.plist" );
        PlistDocument plist = new PlistDocument();
        plist.ReadFromString( File.ReadAllText( plistPath ) );

        //Get Root
        PlistElementDict rootDict = plist.root;

        //Add Necessary Things
        PlistElementArray LSApplicationQueriesSchemes = rootDict.CreateArray( "LSApplicationQueriesSchemes" );
        LSApplicationQueriesSchemes.AddString( "itms-beta" );  // test flight

        // localizations
        PlistElementArray CFBundleLocalizations = rootDict.CreateArray( "CFBundleLocalizations" );
        CFBundleLocalizations.AddString( "en" );    // english
        CFBundleLocalizations.AddString( "de" );    // german
        CFBundleLocalizations.AddString( "fr" );    // french
        CFBundleLocalizations.AddString( "es" );    // spanish

        // for OneSigna remote notifications
        PlistElementArray UIBackgroundModes = rootDict.CreateArray( "UIBackgroundModes" );
        UIBackgroundModes.AddString( "remote-notification" );

        //WriteFile
        File.WriteAllText (plistPath, plist.WriteToString ());

    }

}

Upvotes: 1

Related Questions