Search Unity

Xcode Error when building - Thread 1: EXC_BAD_ACCESS

Discussion in 'Scripting' started by Aerhart941, Jan 2, 2020.

  1. Aerhart941

    Aerhart941

    Joined:
    Apr 7, 2019
    Posts:
    61
    Hello. I am getting the following error from XCODE when I try to build my project on iPhone:

    Code (CSharp):
    1. Thread 1: EXC_BAD_ACCESS (code=1, address=0x38)
    It shows up in four places:

    Code (CSharp):
    1. UnityFramework`NavMeshManager::RegisterAgent:
    Code (CSharp):
    1. UnityFramework`-[UnityFramework runUIApplicationMainWithArgc:argv:]:
    Code (CSharp):
    1. #include <UnityFramework/UnityFramework.h>
    2.  
    3. UnityFramework* UnityFrameworkLoad()
    4. {
    5.     NSString* bundlePath = nil;
    6.     bundlePath = [[NSBundle mainBundle] bundlePath];
    7.     bundlePath = [bundlePath stringByAppendingString: @"/Frameworks/UnityFramework.framework"];
    8.  
    9.     NSBundle* bundle = [NSBundle bundleWithPath: bundlePath];
    10.     if ([bundle isLoaded] == false) [bundle load];
    11.  
    12.     UnityFramework* ufw = [bundle.principalClass getInstance];
    13.     if (![ufw appController])
    14.     {
    15.         // unity is not initialized
    16.         [ufw setExecuteHeader: &_mh_execute_header];
    17.     }
    18.     return ufw;
    19. }
    20.  
    21. int main(int argc, char* argv[])
    22. {
    23.     @autoreleasepool
    24.     {
    25.         id ufw = UnityFrameworkLoad();
    26.         [ufw runUIApplicationMainWithArgc: argc argv: argv];
    27.         return 0;
    28.     }
    29. }
    Code (CSharp):
    1. libdyld.dylib`start:
    2.     0x191b8835c <+0>: nop
    3. ->  0x191b88360 <+4>: bl     0x1919ce908               ; exit
    4.     0x191b88364 <+8>: brk    #0x3
     
    Last edited: Jan 3, 2020
  2. Aerhart941

    Aerhart941

    Joined:
    Apr 7, 2019
    Posts:
    61
    For anyone else that runs into this error the solution was two-fold. You have to uncheck "Strip Engine Code" in Unity under player settings > IOS. Then in Xcode, you have to find (under either Swift or Apple Clang - code generation) a setting called 'Optimization Level' and set it to none.

    Nothing else worked but this. I suspect, once it is time to build the final game, these settings will need to be turned back on to keep the file size down or something.
     
  3. cmersereau

    cmersereau

    Joined:
    Nov 6, 2020
    Posts:
    52
    This solution did not work for me. Did you find out more about how to solve the problem?
     
  4. Roy-Hu

    Roy-Hu

    Joined:
    Apr 13, 2021
    Posts:
    7
    Neither for me :(
     
  5. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Same problem on Unity 2021

    The only way it works is by enabling Development Build on Build Settings
     
  6. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    393
    Hi, we have also ran into this issue. Is there any understanding on the cause? Our app was working fine but it seems some recent change causes us to run into this and the app crashes every time we try to load a particular scene (Unity 2020.3).
     
  7. emersondesign

    emersondesign

    Joined:
    Mar 14, 2015
    Posts:
    5
    Worked for me - THANK YOU!
     
  8. Elapotp

    Elapotp

    Joined:
    May 14, 2014
    Posts:
    98
    Same. But Development Build also crashes.
    Do you know any Unity Stuff to ping here for help?
     
    Last edited: Apr 27, 2022
  9. Dev_GTS

    Dev_GTS

    Joined:
    Mar 8, 2021
    Posts:
    5
    I have removed the unity ads package, and the build is working fine now.
     
  10. chanchangame

    chanchangame

    Joined:
    Sep 29, 2022
    Posts:
    11
    Anyone has anymore info on this? Still happening in Unity 2020.3.39 and Xcode 14.0.1. I have tried disabling Strip Engine code and Optimization Level but the error is still there.
     
  11. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    290
    i'm facing the same issue, the fixes suggested above did not work for me
     
  12. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    290
    Hi sohail , Did you managed to get it to work, i removed unity ads as well and it worked
     
  13. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    776
    I also have this issue! But I found that..
    why someone said "remove Unity ads"
    and it will be back to works?

    Because you have to make sure in Project Settings > Services > Ads first!
    you have to logged in to your account, But if you still log out it also still have this error,
    so when you log in back, everything work perfectly!!!!
     
    Last edited: Jan 3, 2023
  14. GameWorldsDev

    GameWorldsDev

    Joined:
    Dec 8, 2022
    Posts:
    4
    PLEASE EVERYONE!!!! Make sure you have authentication downloaded in this project as it is needed for Vision Pro to operate and for it to enter the app and sign you in through your Apple ID properly .

    After that please direct yourself to Xcode and make sure you have the latest Apple Vision Pro Simulator on there and selected as your run target . Some times it comes with the 1.0 version and once you upgrade everything on unity this also needs to be upgraded . you can do this by going to Xcode>windows> devices and simulators > and pressing the ( +) in the bottom left corner to create/download a new simulator . Select Vision Pro and then the 1.1+ version .( this is written as of 2/27/24 there may be a new version out by now ) .

    If you had version 1.0 or less this will cause an error and your app will not open !

    o IMG_0572.PNG IMG_0573.PNG IMG_0574.PNG IMG_0575.PNG IMG_0572.PNG IMG_0573.PNG IMG_0574.PNG IMG_0575.PNG IMG_0572.PNG IMG_0573.PNG IMG_0574.PNG IMG_0575.PNG IMG_0572.PNG IMG_0573.PNG IMG_0574.PNG IMG_0575.PNG IMG_0572.PNG IMG_0573.PNG IMG_0574.PNG IMG_0575.PNG
     
  15. GameWorldsDev

    GameWorldsDev

    Joined:
    Dec 8, 2022
    Posts:
    4
    remember to also have these packages downloaded and up to date along with the XR plug in manager in unity .
    PACKAGE NAME: com.unity.xr.visionos



    ADD THE FOLLOWING PACKAGES:

    com.unity.polyspatial

    com.unity.polyspatial.visionos

    com.unity.polyspatial.xr



    QUOTE="GameWorldsDev, post: 9667877, member: 11504637"]PLEASE EVERYONE!!!! Make sure you have authentication downloaded in this project as it is needed for Vision Pro to operate and for it to enter the app and sign you in through your Apple ID properly .

    After that please direct yourself to Xcode and make sure you have the latest Apple Vision Pro Simulator on there and selected as your run target . Some times it comes with the 1.0 version and once you upgrade everything on unity this also needs to be upgraded . you can do this by going to Xcode>windows> devices and simulators > and pressing the ( +) in the bottom left corner to create/download a new simulator . Select Vision Pro and then the 1.1+ version .( this is written as of 2/27/24 there may be a new version out by now ) .

    If you had version 1.0 or less this will cause an error and your app will not open !

    o View attachment 1377071 View attachment 1377074 View attachment 1377077 View attachment 1377080 View attachment 1377071 View attachment 1377074 View attachment 1377080 View attachment 1377071 View attachment 1377074 View attachment 1377077 View attachment 1377080 View attachment 1377071 View attachment 1377074 View attachment 1377077 View attachment 1377080 View attachment 1377071 View attachment 1377074 View attachment 1377077 View attachment 1377080 [/QUOTE]