Search Issue Tracker

Third Party Issue

Votes

8

Found in

2022.3.17f1

2023.2.5f1

2023.3.0b2

Issue ID

UUM-60716

Regression

No

[iOS] Crash when opening App using a deep link while Facebook SDK is installed

--

-

How to reproduce:
1. Open the attached Project "DeepLinkTest"
2. In the Project Settings go to Player -> iOS -> Other Settings
3. Change the Size of "Supported URL schemes*" to 1 and set Element 0 to "test"
4. Build and install the Project on an iOS device
5. On the iOS device, open the browser app and go to "test://"

Expected result: The app opens
Actual result: The app crashes

Reproducible with: 2022.3.17f1, 2023.2.5f1, 2023.3.0b2
Could not test with: 2021.3.34f1 (Xcode project fails to build)

Reproduced on:
- iPhone 12 mini (iOS 14.1)
- iPad Air 4th Gen (iOS 15.2.1)

First lines of the Stack trace:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x35f)
frame #0: 0x00000001068fb088 UnityFramework`core::StringStorageDefault<char>::assign(char const*, unsigned long) + 28
frame #1: 0x0000000106834268 UnityFramework`PlayerSettings::SetAbsoluteURL(core::basic_string<char, core::StringStorageDefault<char> > const&) + 44
frame #2: 0x00000001068afaf0 UnityFramework`UnitySetAbsoluteURL + 100
frame #3: 0x00000001061c5c80 UnityFramework`-[UnityAppController application:openURL:options:] + 192

  1. Resolution Note:

    Issue is in the FacebookSDK, as it is modifying the generated Xcode project

    Workaround, until new version of SDK is released, is to (un)modify the file each time it is built
    Path: XcodeProject/Classes/UnityAppController.mm Line ~334 (Might change depending on Unity version) the return YES; needs to be changed to NO

    - (BOOL)isBackgroundLaunchOptions:(NSDictionary*)launchOptions
    {
    if (launchOptions.count == 0)
    return NO;

    // launch due to location event, the app likely will stay in background
    BOOL locationLaunch = [[launchOptions valueForKey: UIApplicationLaunchOptionsLocationKey] boolValue];
    if (locationLaunch)
    return YES;
    return NO; // If this returns YES, then FacebookSDK modified it, and it needs to be changed back to NO
    }

    A PR for FacebookSDK has been created
    https://github.com/facebook/facebook-sdk-for-unity/issues/712#issuecomment-1906094125

Comments (2)

  1. eranroza

    Feb 11, 2024 07:44

    Worked for me

  2. unity_877B2C4C4EBA6FFD1E4D

    Jan 24, 2024 17:48

    After changing the Yes into a No, both manually and via script, the app still crashes

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.