Start a new topic

Error while using Cloud Build for iOS

I'm attempting my first Unity iOS cloud build, and I haven't been terribly successful.  The build fails with the error "WikitudeSDK not found in dylib search path".


After looking at other forum posts, I've tried adding a post process build script, but I'm still pretty new at this, so I may have made an error.


 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEditor.iOS.Xcode.Extensions;

public class iOSPostProcessBuild 
{

    [PostProcessBuild]
    public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    {
    
        if (buildTarget == BuildTarget.iOS)
        {
            string projectPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";

            PBXProject pbxProject = new PBXProject();
            pbxProject.ReadFromFile(projectPath);

            string target = pbxProject.TargetGuidByName("Unity-iPhone");

            string frameworkPath = "Frameworks/Plugins/iOS/WikitudeNativeSDK.framework";
            string fileGuid = pbxProject.FindFileGuidByProjectPath(frameworkPath);

            pbxProject.AddFileToBuild(target, fileGuid);
            pbxProject.AddFileToEmbedFrameworks(target, fileGuid);
            foreach (var configName in pbxProject.BuildConfigNames())
            {
                var configGuid = pbxProject.BuildConfigByName(target, configName);
                pbxProject.SetBuildPropertyForConfig(configGuid, "LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks");
            }

            pbxProject.WriteToFile(projectPath);
        }
    }

 

1 Comment

Hi, 


This is the version that we're using for our CI builds:

static void UpdateXcode(BuildTarget buildTarget, string pathToBuildProject) {
    if (buildTarget == BuildTarget.iOS) {
        var projectPath = Path.Combine(Path.Combine(pathToBuildProject, "Unity-iPhone.xcodeproj"), "project.pbxproj");
        var project = new PBXProject();
        project.ReadFromFile(projectPath);

        var framework = project.FindFileGuidByProjectPath("Frameworks/WikitudeSDK.framework");
        var target = project.TargetGuidByName(PBXProject.GetUnityTargetName());
        project.AddFileToEmbedFrameworks(target, framework);

        project.WriteToFile(projectPath);
    }
}


If this still doesn't work, please specify which version of the Wikitude SDK, Unity Editor and Xcode you're using.


Thank you,

Alexandru

Login or Signup to post a comment