Skip to content

Latest commit

 

History

History
135 lines (87 loc) · 3.7 KB

README-ios.md

File metadata and controls

135 lines (87 loc) · 3.7 KB

Config for iOS

Cleanup:

  • Delete the Unity-iPhone.xcodeproj inside your Xcode workspace.

  • In the main project (TestTabsApp in my case) > General > Frameworks, Libraries and Embedded Content > Delete the UnityFramework.

  • Also in the main project > Product > Scheme > Edit Scheme... > Build > Delete the UnityFramework.

  • Stop the packager.

Reimport the UnityProject:

  • Re-export the Unity Project if needed.

  • Add ios/UnityExport/Unity-iPhone.xcodeproj into the workspace (Right click > Add files to...).

  • In Unity-iPhone/Data, change the Target Membership to UnityFramework.

  • In the main project > General > Frameworks, Libraries and Embedded Content > Add the UnityFramework.

  • In the main project > Product > **Scheme **> Edit Scheme... > Build > Add UnityFramework and move it above everything else.

  • (Optional) In the main project > Build Phases > Move Embed Frameworks like so:

Additional config codes:

  • In the main project, make sure that this is the code inside main.m:

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

#import "UnityUtils.h"

int main(int argc, char * argv[]) {
    @autoreleasepool {
        InitArgs(argc, argv);
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}
  • In the Unity Project, if you get error undefined symbol _onUnityMessage, in UnityMessageManager.cs (add UnityMessageManager., but if you import this script from my .unitypackage from above, just skip), else, edit like so and re-export the Unity Project:

#if UNITY_IOS && !UNITY_EDITOR
    UnityMessageManager.onUnityMessage(message);
#endif
  • OR if you get error undefined symbol _UnityMessageManager_onUnityMessage:

Just go and re-edit like so, then re-export the project, clean then rebuild:

#if UNITY_IOS && !UNITY_EDITOR
    onUnityMessage(message);
#endif

Rerun:

  • IF Build succeeded, but the app isn't installed nor launched on the device:

    • (Optional) Unplug and replug the iPhone.

    • (Optional) Close and reopen Xcode workspace.

    • Delete the app on the device.

    • Clean the build.

    • Restart the packager.

    • Rebuild.

Really this can happen frequently if you re-export your Project... And I promise this has got to be something with the Xcode build and packager. If this isn't working just repeat. The 3 last steps can be executed in any orders, until it works haha.