top of page
Search
Writer's pictureMadhu Kalva

Unity: iOS build errors compilation

Updated: Nov 15, 2022


 

Invalid Bundle. The bundle at '<BlaBla>.app/Frameworks/UnityFramework.framework' contains disallowed file 'Frameworks'.

  1. Go to Build Settings

  2. Select UnityFramework from the Targets panel

  3. Under "Build Options" Set "Always Embed Swift Standard Libraries" to "No"

Or just add this script(XcodeSwiftVersionPostProcess.cs) to your project and during build it will be automatically changed



using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
 
public static class XcodeSwiftVersionPostProcess
{
    [PostProcessBuild(999)]
    public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    {
        if (buildTarget == BuildTarget.iOS)
        {
            ModifyFrameworks(path);
        }
    }
 
    private static void ModifyFrameworks(string path)
    {
        string projPath = PBXProject.GetPBXProjectPath(path);
           
        var project = new PBXProject();
        project.ReadFromFile(projPath);
 
        string mainTargetGuid = project.GetUnityMainTargetGuid();
           
        foreach (var targetGuid in new[] { mainTargetGuid, project.GetUnityFrameworkTargetGuid() })
        {
            project.SetBuildProperty(targetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "NO");
        }
           
        project.SetBuildProperty(mainTargetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
 
        project.WriteToFile(projPath);
    }
}



 

Invalid SWIFT_VERSION: Could not parse version component from: '1 5'

  1. Select UnityFramework Target and go to Build Settings.

  2. Change Swift Language Version from "Swift 5" to "Swift 5" (no mistake here).

  3. Try deploying it again.


 

GoogleAppMeasurement requires CocoaPods version `>= 1.10.2, which is not satisfied by your current version, 1.10.1


First double-check cocopods version with

pod --version

you will realize it has cocopods 1.10.1 version as is mentioned in the error. To fix this do the following

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.10.2

Note: don't run sudo gem install cocoapods because it will get the latest cocopods which is probably not what you want.


 

Missing RegisterMonoModule.h


With Unity 2019.3 or above if you use Facebook SDK you will get this error Missing RegisterMonoModule.h while building in XCode.


 

Exception: Calling TargetGuidByName with name='Unity-iPhone' is deprecated.


In my case, I am using Unity 2019.4.17f1 and integrating MoPub for monetization. Then, I see this error when I try to build for iOS.


To fix this have to use GetUnityMainTargetGuid instead of TargetGuidByName.

So replace following

var target = project.TargetGuidByName("Unity-iPhone");

with

var target =
	#if UNITY_2019_3_OR_NEWER    
	    project.GetUnityMainTargetGuid();
	#else    
	    project.TargetGuidByName("Unity-iPhone");
	#endif


 

'MoPub.h' file not found

When I integrated MoPub's Facebook Audience Network(FAN) mediation network, I saw this error. This is because FAN uses use_frameworks! and iOS won't build with use_frameworks! in Podfile.


Workaround:

  1. Remove <iosPod name="MoPub-SDK-Plugin" minTargetSdk="10.0" path="Assets/MoPub/Plugins/iOS"/> from Assets/MoPub/Scripts/Editor/MoPubDependencies.xml

  2. Delete Assets/MoPub/Plugins/iOS/MoPub-SDK-Plugin.podspec

  3. Check iOS as platform for plugin for all files inside Assets/MoPub/Plugins/iOS



713 views0 comments

Recent Posts

See All

Retention Tips:

Garding levels: Easy, Medium, Hard, etc Source: https://youtu.be/YSJvz6ilf60?t=371 Point out when something is difficult. Higher...

CPI Tips:

Watching AD to Game Install Funnel Source: https://youtu.be/AqO_kunQbGY?t=154 Keep contrast between key game elements Source:...

HC new comers resources

Voodoo Live Sessions Alexander Shea : Publishing Hyper-Casual Games In 2022 Raketspel : How To Increase Engagement In Hyper-Casual Games...

Comments


bottom of page