问题
Since yesterday Xcode is doing stupid things while trying to run my WatchKit app on my iPhone. It gives me the error:
Embedded Binary Validation utility Error
Error: warning: Is a directory
It's not very helpful and it seems like it's complaining about provisioning profiles for my Watchkit Extension target. I think I set it up correctly by following this answer.
This is how I have set up my profiles. Three App IDs and six profiles (three for development and three for distribution).
Main app:
WatchKit Extension:
WatchKit Watch App:
回答1:
I had my custom framework linked and embedded in both the WatchKit Extension and the App. Removing the framework from General > Embedded Binaries of the WatchKit Extension fixed it for me. I did have to delete my Build folder and restart Xcode.
回答2:
I have been able to resolve the issue with the correct Provisioning Profiles setup.
With Xcode 6.2
I have been able to do a development/debug build with automatic set and no extra PPs for development in the portal, but using team provisioning.
Now with Xcode 6.3
I had to add 3 explicit PPs for development in the portal and assign them in the project settings.
回答3:
I've been fighting this error as well. For me, sometimes it builds, sometimes it doesn't. This is how I'm currently able to archive my WatchKit app. I'm not claiming any knowledge as to why this works, just that it works for me.
- Clean Shift-Command-K
- Quit Xcode
- Delete files in ~Library/Developer/Xcode/Derived Data
- Reopen Xcode and Archive
回答4:
For me the only way to fix this was to remove all spaces from schema name and watch app name.
To change schema name: (eg schema is "amazingapp RC")
1) Click on schema in xCode (It is where you choose device/simulator)
2) From the list choose: "edit schema"
3) When the new modal open press "duplicate schema" in left bottom corner.
4) Choose proper name without whitespaces and save.
5) Now press manage schemes and select old one.
6) Remove it by pressing "-" button
Now it is time for extension name:
1) Click on schema in xCode (It is where you choose device/simulator)
2) Choose extension schema
3) Click "edit schema"
4) Choose Archive (release) at the bottom of the left section
5) Enter a proper name without spaces in "Archive Name"
6) Close.
Now build->clean, build->archive and you should be good to go.
回答5:
UPDATE: I've been having this issue on another project and managed to solve it by removing spaces in my WatchKit App and Extension target names. So before my target names were APPNAME WatchKit App
and APPNAME WatchKit Extension
changing them to APPNAMEWatchKitApp
and APPNAMEWatchKitExtension
Fixed everything!
ORIGINAL: Just to add my two cents I've been struggling with this issue for a few weeks now. I've narrowed it down to including CocoaPods in the project but without a more descriptive error I've got no idea why.
I know my provisioning profiles are correct as a blank project (inc a WatchKit target) archives successfully with them. There are no static libraries in my WatchKit extension so that's not the problem either..
In the end the only thing that reliably works is using xcodebuild
+ xcrun
in terminal to build and archive my project. This article explains xcode in the terminal well.
回答6:
I followed @dogsgod's suggestions, revoked all my certs etc. started over, 6 profiles, no luck. After doing this for almost 6 hours, another team member checked it out and it worked (letting xcode fix the issues for them). Making sure that groups were turned on for all the app id's (I am using groups to share data between watchkit and main app)
So, i thought it was just my xcode.
Then I went to git, cloned it, and then compiled it just fine.
Perhaps everything in my gitignore got rid of whatever files were blocking me. Or perhaps because i pulled it after they committed it. It's almost just voodoo at this point, but it worked
回答7:
In my case it turned out to be my Xcode Preferences.
I had my DerivedData -> Advanced Settings (Build Location) set to "Custom" = "Relative to Workspace".
I changed it to Unique and that made it work.
Hopefully that helps someone.
回答8:
EDIT: A day later I can share one more thought. While the git cloning works, the problem resurfaces after I make some changes. Which makes me wonder if the problem comes from a bad file formatting (like non unix-like EOF or similar) or just a bug in Xcode. Anyways, my workflow currently is as follows:
1) git clone to another directory
2) archive
3) if there is an error, I need to fix it,
4) git commit & git push
5) repeat steps 1 & 2 ...
Which is bothersome, but it's the only way I can archive my project and actually upload it to the App Store...
ORIGNAL POST: I have encountered this error as well. My project uses CocoaPods, multiple targets and build schemes as well as group entitlements. At times I can't build, although this is fixable (see below) but the problem with archiving persited for a longer time. After two days of fighting with it, my summary is as follows:
I have followed all the responses and I can see that sometimes doing:
1) clean project
2) (optional - not alwys needed) restart Xcode
3) delete derived data folder contents
allows me to compile and run the App. But I still can't archive. Sometimes it seems that I have to do it twice.
Apart from the above, I have tried (and failed to archive) the following suggestions:
- rename the target names (and containing folders) to NOT include whitespaces, the Extension and WatchApp targets doesn't have whitespaces in their respective names, but the project won't archive (no change)
- I have checked that there's no embedded binaries in the Extension Target (watchApp don't have this option)
- I have tried changing the deployment target (default was iOS 8.3 for Xcode 6.4) to both 8.2 and 8.4 with no luck in archiving.
- I have recreated the AppIDs and all the provisioning profiles for both "adHoc" and "release schemas", no luck either.
- and I have verified that the current schema I'm trying to archive doesn't have whitespaces, but it still doesn't change anything.
- I have even tried the last suggestion, i.e. changing the default Derived Data folder location but, as I have suspected, it haven't changed anything.
Interestingly, what actually HAVE WORKED is the suggestion from Mike Manh: checking out the repo to another folder.
After cloning the repo to a new empty folder, everything suddenly started working. This leads me to the conclusion that there might be some leftover files/broken links/whatever in my current project folder. I guess this could've happen when I was trying to rebase my watchKit development branch into the current master branch. Which started trowing me some crazy conflicts and I have finally aborted the rebase. Possibly it was the point when the archive option ceased to function normally.
回答9:
I had the same problem. In Xcode 6.* I fixed it by cleaning my DerivedData folder. But in new Xcode 7 it didn't help. So I removed spaces in WatchKit Extension and WatchKit App ("planckMailiOS WatchKit App" -> "planckMailiOSWatchKitApp" and "planckMailiOS WatchKit Extension" -> "planckMailiOSWatchKitExtension").
来源:https://stackoverflow.com/questions/29611172/embedded-binary-validation-utility-error