Search Unity

UriFormatException when compiling with own build command

Discussion in 'Unity Everyplay' started by mark_ff, Oct 8, 2015.

  1. mark_ff

    mark_ff

    Joined:
    Jul 24, 2012
    Posts:
    21
    I'm getting the following exception when I try to export an iOS unity project with EveryPlay:

    UriFormatException: Invalid URI: The format of the URI could not be determined: bin/ios/.
    System.Uri..ctor (System.String uriString, Boolean dontEscape)
    System.Uri..ctor (System.String uriString)
    Everyplay.XCodeEditor.XCProject.AddFile (System.String filePath, Everyplay.XCodeEditor.PBXGroup parent, System.String tree, Boolean createBuildFiles, Boolean weak) (at Assets/Editor/Everyplay/XCodeEditor/XCProject.cs:399)
    Everyplay.XCodeEditor.XCProject.ApplyMod (Everyplay.XCodeEditor.XCMod mod) (at Assets/Editor/Everyplay/XCodeEditor/XCProject.cs:684)
    Everyplay.XCodeEditor.XCProject.ApplyMod (System.String rootPath, System.String pbxmod) (at Assets/Editor/Everyplay/XCodeEditor/XCProject.cs:634)
    EveryplayPostprocessor.ProcessXCodeProject (System.String path) (at Assets/Editor/Everyplay/Scripts/EveryplayPostprocessor.cs:180)
    EveryplayPostprocessor.PostProcessBuild_iOS (System.String path, System.String clientId) (at Assets/Editor/Everyplay/Scripts/EveryplayPostprocessor.cs:86)
    EveryplayPostprocessor.OnPostProcessBuild (BuildTarget target, System.String path) (at Assets/Editor/Everyplay/Scripts/EveryplayPostprocessor.cs:28)
    UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
    AutoBuild:BuildForIOSDev() (at Assets/Editor/AutoBuild.cs:16)

    This is the build method I'm using (based on this):

    [MenuItem("Autobuilds/Build for iOS Dev")]
    public static void BuildForIOSDev()
    {
    BuildOptions options = BuildOptions.Development;
    UnityEditor.BuildPipeline.BuildPlayer(new string[] { "Assets/Levels/level1.unity" }, "bin/ios", BuildTarget.iOS, options);
    }

    There aren't any problems building via the build settings panel, however I need to be able to build this project from the command line as we compile all our unity projects on a jenkins box.
     
  2. mark_ff

    mark_ff

    Joined:
    Jul 24, 2012
    Posts:
    21
    Just to clarify, Unity does actually spit out the xcodeproject, however I'm guessing something in the post-processing is failing to complete, since attempting to compile the xcodeproject gives these errors:

    Undefined symbols for architecture armv7:
    "_OBJC_CLASS_$_SLComposeViewController", referenced from:
    objc-class-ref in Everyplay(Everyplay)
    "_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
    objc-class-ref in Everyplay(Everyplay)
    "_OBJC_CLASS_$_ALAssetsLibrary", referenced from:
    objc-class-ref in Everyplay(Everyplay)
    "_OBJC_CLASS_$_SLRequest", referenced from:
    objc-class-ref in Everyplay(Everyplay)
    "_OBJC_CLASS_$_MFMessageComposeViewController", referenced from:
    objc-class-ref in Everyplay(Everyplay)
    "_SLServiceTypeTwitter", referenced from:
    +[EveryplayTwitter isLocalTwitterAccountAvailable] in Everyplay(Everyplay)
    ___38+[EveryplayTwitter obtainAccessToken:]_block_invoke_2 in Everyplay(Everyplay)
     
  3. mark_ff

    mark_ff

    Joined:
    Jul 24, 2012
    Posts:
    21
    Just in case anyone has the same issue, I was able to resolve this by selecting EveryPlay.bundle and EveryPlay.framework in the unity editor, enable the iOS platform and then tick these missing frameworks:

    Accounts
    Security
    Social
    StoreKit
    Twitter
    AssetsLibrary
    CoreImage
    MessageUI

    then checking in the relevant meta files. I think this is normally set by the Everyplay postprocessor, but for me at least, that wasn't working from the command line.

    The URIFormatException was a bit of a red herring, I was able to fix that by changing the local path in my build script ("bin/ios") to an absolute path.

    My build environment was as follows:

    Jenkins 1.614 installed on a Mac Mini (Late 2014, 3GHz i7, 16gb RAM)
    OSX Yosemite 10.10.5
    XCode 7.0.1
    tested with Unity 5.1.3p3 and 5.2.1p2

    I was seeing it in a really basic project with just the everyplay plugin and my build script (above).

    Command line args:
    -quit -batchmode -nographics -projectPath "${WORKSPACE}" -executeMethod AutoBuild.BuildForIOSDev
     
  4. Rex-Raptor

    Rex-Raptor

    Joined:
    Feb 10, 2015
    Posts:
    2
    Thanks for this. It helped me figure out my issues.

    FYI - I was getting the same UriFormatException: Invalid URI: The format of the URI could not be determined
    error and for me it turned out that EveryPlay doesn't like it when you build inside your project folder. I did a build outside my project and all my problems were solved.
     
  5. pmjo

    pmjo

    Unity Technologies

    Joined:
    Sep 17, 2013
    Posts:
    245
    Actually Everyplay does not like the relative path that Unity 5.4.x is giving. A fix for similar issue was already published some time ago however we found out that some OSX versions needed another small workaround. Here is a hot fix for this issue until a new release is out.
     

    Attached Files: