Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[4.6.2 & 4.6.2p1, OSX]: Unable to 'Append' to Xcode project - 'Replace' works

Discussion in 'iOS and tvOS' started by larku, Feb 6, 2015.

  1. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    ***
    *** EDIT: This issue is now resolved for me using Unity 4.6.3p1.
    ***


    Note:
    reposted here in a more suitable sub forum: http://forum.unity3d.com/threads/4-...append-to-xcode-project-replace-works.296259/

    I'm creating a new thread for this issue as it seems to be being overlooked in this thread: http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551

    Environment:

    Unity : 4.6.2p1
    Xcode : 6.1.1
    OS X : 10.10.1
    Build : Mono armv7


    Two distinct issues.

    Issue 1: FogBugz: 668511

    I've upgraded to Unity 4.6.2p1 and now I have a similar problem as I posted before (FogBugz: 668511) with a different error. Every time I try and append to an existing Xcode project I now get the error (note, replace works fine so it's unlikely to be my project/code/etc):

    Error building Player: ArgumentNullException: Argument cannot be null.
    Parameter name: key

    (Filename: Line: -1)


    Note: I started with a new fresh Xcode project after upgrading to 4.6.2p1 to avoid any issues caused from 4.6.2 in the project.

    There is nothing of interest in the editor log either (other than the above error message).

    I noted some other user also posted the same issue here http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551/#post-1919105 - but no additional information there.

    This is a really serious issue - I can't do build-test turn around, it's gone from taking minutes to over an hour each time and is an absolute dragon's lair for introducing errors in the build (could easily forget to set something up).

    I'd really appreciate some feedback on this issue, are Unity staff aware of this issue? - it's killing my development time and making me very nervous about doing a release having to hand build my Xcode project between each Unity build.

    Issue 2:

    Now doing a build and appending to an existing Xcode project can give the error:

    Error building Player: Exception: Invalid PBX project (parsing line 619)

    Again, there is nothing of interest in the editor log either (other than the above error message).

    Note, this is not an IL2CPP build - just a standard mono build.

    Looking in the [project]/Temp/StagingArea/Trampoline/Unity-iPhone.xcodeproj file shows line 619 as:

    shellScript = "rm -rf \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data\"
    cp -Rf \"$PROJECT_DIR/Data\" \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data\"";


    It is broken over two lines like is shown here (I think that is the issue).

    The same line (different line number but content is the same) in the Xcode project from a 'Replace' rather than an 'Append' (in [Xcode project]/Unity-iPhone.xcodeproj/project.pbxproj ) looks like:

    shellScript = "rm -rf \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data\"\ncp -Rf \"$PROJECT_DIR/Data\" \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data\"";

    As you can see the '\n' is in place and is not converted to a newline (ie, it's not split over two lines - despite being shown here on two lines).

    It seems that editing the [project]/Temp/StagingArea/Trampoline/Unity-iPhone.xcodeproj file to replace the newline with a \n appears to enable the build to get further but my issue 1 above then returns - so since the build has still not succeeded I can't be sure this actually works yet either.

    Again, I'd really appreciate some feedback on this, does Unity know about this issue? Are they looking at it? It seems to be a very serious issue that you must rebuild an Xcode project every time you want to build from Unity (we depend on a lot of native code and SDKs that require lots of Xcode configuration - this is seriously killing my development time and providing too much room for error producing builds for release.
     
    Last edited: Feb 27, 2015
    Ale Moreno likes this.
  2. Ale Moreno

    Ale Moreno

    Joined:
    Jul 31, 2013
    Posts:
    7
    Here the same. We updated to 4.6.2p1, bu nothing.

    Only Replace fix it.

    Regards
     
  3. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
  4. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Agreed, sorry, I'm reasonably new around here and didn't even realise that sub forum existed.

    I'll repost there and make note in my post for the mods.

    Thanks for the heads-up.
     
  5. Aurore

    Aurore

    Director of Real-Time Learning Unity Technologies

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    It's moved, no need to create a duplicate.
     
  6. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Yes, I have seen this issue too.

    Doing an 'Append' makes a project that Xcode cannot open (parse error).
     
  7. frankprogrammer

    frankprogrammer

    Joined:
    Apr 27, 2009
    Posts:
    17
  8. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Just updating - The Unity devs are now looking into this issue, so they know about it and have reproduced it to some degree.

    So I'd expect a fix in a patch release soon (presumptuous of me, but they seem pretty quick with getting these fixes out)
     
  9. pordox1

    pordox1

    Joined:
    Sep 11, 2012
    Posts:
    10
    Same issues here, hope that there will be a solution soon.
     
  10. pordox1

    pordox1

    Joined:
    Sep 11, 2012
    Posts:
    10
    Replacing that line does the trick for me. A workaround at least, thanks for the hint larku.
     
    frankprogrammer and larku like this.
  11. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    541
    Anyone knows if this is fixed in 4.6.2p2? This is so pretty annoying, we had to downgrade to 4.5.5.
     
  12. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    I didn't see it mentioned in the release notes.
     
  13. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    541
    Yeah, that's what worries me :)
     
  14. pordox1

    pordox1

    Joined:
    Sep 11, 2012
    Posts:
    10
    I've installed patch2, the issue is still there.

    //Edit: We use some 3rd party plugins in our game. So I've startet to import them one by one in a clean unity project. Turns out that Stan's Ultimate Mobile plugin causes the error. Well it's at least something. I don't know just yet what exactly causes the build problems. The search continues...
     
    Last edited: Feb 13, 2015
  15. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    541
    @pordox1 Thanks for the info. I also tried the new p2 version, but I got just another error with cross compilation and stripping (which worked in p1). That's pretty bad :/ I'll investigate our plugins, maybe I can find something in our project.
     
  16. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    541
    Ok, p2 is for us pretty unstable. Each build either fails during cross compilation or freezes (screenshot).

    Ok, back to 4.5.5 :(
     

    Attached Files:

  17. pordox1

    pordox1

    Joined:
    Sep 11, 2012
    Posts:
    10
    I found a script within the UM plugin which links post-process frameworks, linker and compiler flags with a python script. Something goes wrong in there. So you may check your build process, paths, flags and frameworks... meh ^^
     
  18. pordox1

    pordox1

    Joined:
    Sep 11, 2012
    Posts:
    10
    Ok it seems like the problems occur after modifying and saving the project.pbxproj with the python script. After saving the file, that \n is misinterpreted.


    //Edit: So do you have an mod_pbxproj.py script in use? It may cause the troubles. From here now on I need some hint from the python experts ;-)
     
    Last edited: Feb 13, 2015
  19. pordox1

    pordox1

    Joined:
    Sep 11, 2012
    Posts:
    10
    I replaced mod_pbxproj.py with another, newer version, and it works perfectly ;)
     
    pahe likes this.
  20. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    541
    That means it's related to one of the plugins which modify the xCode project after building. Thanks for the info @pordox1 Very much appreciated. I'll take a deeper look into my plugins and check if any of them is not up2date.
     
  21. s0phist

    s0phist

    Joined:
    Mar 30, 2011
    Posts:
    40
    I also have problem 1 above using 4.6.2 and 4.6.3 - I suspect it's related to the parse sdk or facebook sdk. Do you have one of those in your project?
     
  22. VNL-Entertainment-Games

    VNL-Entertainment-Games

    Joined:
    Feb 10, 2015
    Posts:
    78
    It is extremely annoying! Hope it will be fixed soon.
     
  23. Gasp

    Gasp

    Joined:
    Apr 9, 2013
    Posts:
    8
    We have the same problem. We are using the Facebook SDK, not the parse SDK.
     
  24. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    I have this issue in a project that uses neither. I haven't yet investigated what exactly is causing it.
     
  25. frankprogrammer

    frankprogrammer

    Joined:
    Apr 27, 2009
    Posts:
    17
    Just got a response back on my bug report for this:
    http://fogbugz.unity3d.com/default.asp?670103_21b51qc0i9n9d6o7
    Hopefully we will see it in 4.6.3p1
     
  26. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    That's excellent Frank84 my bug report was being addressed but was then closed with no explanation - seems they are tracking this through your bug now (would be nice if they had indicated that to me when they closed my bug report - a bit frustrating).

    As long as this gets fixed I'll be happy!!
     
  27. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
  28. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    This issue is now resolved for me using Unity 4.6.3p1.

    Hopefully 4.6.3p1 fixes things for everyone.
     
  29. qwiboo

    qwiboo

    Joined:
    Nov 20, 2013
    Posts:
    9
    Unfortunately it does not, still happening for me :(
     
  30. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    :( - I'd suggest submitting a but report with Unity including a project that can reproduce the problem you're having. Unity consider this bug fixed and the bug report has been closed. You'll need to help them with a new bug report.
     
  31. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    541
    I can say that 4.6.3p1 fixed the problem on my side. If you haven't tried it, do it. Else, try Unity 5 ;)
     
  32. s0phist

    s0phist

    Joined:
    Mar 30, 2011
    Posts:
    40
    Mine was also fixed by 4.6.3p1
     
  33. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    Please make sure to delete the app from the device in cases like this.
     
  34. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    I'm in 4.6.3 and also having the same issue (Error building Player: ArgumentNullException: Argument cannot be null.
    Parameter name: key)

    I don't know if it has been fixed in any of the patch releases because I have problems installing them LINK
     
  35. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    There was this fix in 4.6.3p1:

    • (668511) 672455) - iOS: Improved Xcode project parser robustness for invalid input
    Can anyone confirm that this is indeed the fix?
     
  36. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Yes this does appear to be fixed for most users with 4.6.3p1 (and I assume 4.6.3p2).

    I've also replied to your other thread.
     
  37. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    I'm afraid I can't upgrade to 3.6.3p1 or 3.6.3p2,the editor crashes due to memory errors. I still have the problem in 4.6.2p2
     
  38. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I assume the 3.6.3p1/p2 is actually a typo for 4.6.3p1/p2.

    What 'memory errors' are you referring to? these releases work fine for most. I have not seen any other reports of 'memory errors', so perhaps this is a local issue that need to be resolved (and may persist for all new Unity releases for you).
     
  39. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    Ahhh sorry it was a typo.

    Unity crashing because of running out of memory when making an iOS build with big projects has happened from time to time during the whole Unity's life. The main problem here is that the build is not as big (350 Mb iOS IPA) and it only happens on the latest 4.6.3p1/p2. Im'm using a 27" 16Gb iMac, so I'm pretty sure is something related to the changes included in 4.6.3p1/p2 .
     
  40. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Now getting a different build error under 4.6.3p3 when appending.

    Error building Player: ArgumentException: An element with the same key already exists in the dictionary.
     
  41. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    I just downloaded 4.6.3p3 and still get memory crash, so I can't check if append works.
     
  42. supernat

    supernat

    Joined:
    May 3, 2011
    Posts:
    45
    For me, this problem was caused by adding files to my XCode project after it was created in Unity, but specifically after adding files that were already added in an older project file that maybe existed in a different location. It was as simple as deleting the duplicate entry from the XCode project file (located at your_export_dir/Unity-iPhone.xcodeproj/project.pbxproj. I went to the CustomTemplate section and removed a couple of children until I found the offender, but it became obvious why after I did a search for the offending name (the value that is between /* and */). There were two sections in the XML below that that said "name = whatever", so that's where Unity is failing to build. After removing the offending files/folders, you may have to add them back.
     
  43. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    Just an update. On Unity 4.6.4p4 I can build and append perfectly. But can't attach to debugger....