Search Unity

Automated IOS build failure with "project.xcworkspace" doesn't exist

Discussion in 'Editor & General Support' started by whydoidoit, Jan 10, 2013.

  1. whydoidoit

    whydoidoit

    Joined:
    Mar 12, 2012
    Posts:
    365
    So I have a fully building IOS project that I want to now automate the build of. When I run my build command everything seems fine until it tries to open the Xcode project at which time I get an XCode dialog box saying

    The file "project.xcworkspace" doesn't exist.
    My project uses a combination of plugins - but builds fine if I do "Build Run"

    The build function looks like this:
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using UnityEditor;
    5. using System.Collections.Generic;
    6. using System;
    7.  
    8. public class AutomatedBuild  {
    9.  
    10.  
    11.     static string APP_NAME = "RadicalRealms";
    12.     static string TARGET_DIR = "ios";
    13.  
    14.     [MenuItem ("Custom/CI/Build IOS")]
    15.     static void PerformIOSBuild ()
    16.     {  
    17.  
    18.        EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.iPhone);
    19.        EditorUserBuildSettings.appendProject = true;
    20.        EditorUserBuildSettings.allowDebugging = false;
    21.        EditorUserBuildSettings.development = true;
    22.        var result = BuildPipeline.BuildPlayer(FindEnabledEditorScenes(), "Builds/ios", BuildTarget.iPhone, BuildOptions.AutoRunPlayer | BuildOptions.Development | BuildOptions.AcceptExternalModificationsToPlayer);
    23.        if(result.Length > 0)
    24.        {
    25.          throw new Exception(result);
    26.        }
    27.     }
    28.  
    29.     private static string[] FindEnabledEditorScenes() {
    30.        List EditorScenes = new List();
    31.        foreach(EditorBuildSettingsScene scene in EditorBuildSettings.scenes) {
    32.          if (!scene.enabled) continue;
    33.          EditorScenes.Add(scene.path);
    34.        }
    35.        return EditorScenes.ToArray();
    36.     }
    37.  
    38. }
    39.  
    Cross posted on Unity Answers: http://answers.unity3d.com/questions/377977/automated-ios-build-failure-projectxcworkspace-doe.html
     
  2. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    I reported the issue to Unity and it turns out to be a bug, fortunately there is a workaround.

    I found that the easiest way to remedy this is to use Path.GetFullPath() on the path string.