Xcode 7 will NOT build a valid Archive from the same project that builds a valid archive in Xcode 6

老子叫甜甜 提交于 2019-12-18 12:24:44

问题


When using Xcode 7b5 to build my app that contains a Today Extension I cannot create a valid archive. When I make an archive the build succeeds and then in Organizer it shows up under "Other Items" instead of under "iOS Apps".

If I close the project and open up the same project in Xcode 6.3.2 when I make the archive it shows up under "iOS Apps".

I compared the archives and the one thing I noticed is that my Today Widget is being placed outside of the Applications directory. The structure looks like this for Xcode 6.3.2 vs Xcode 7b5:

Xcode 6.3.2
|-Archive
|--Products
|---Applications
|----MyMainApp.app

Xcode 7 Beta 5
|-Archive
|--Products
|---Applications
|----MyMainApp.app
|---MyTodayWidget.appex

I think the problem is that the MyTodayWidget is packaged outside of the Applications dir and outside of the .app. I'm not sure why Xcode 7 beta 5 would package the app differently than Xcode 6.3.2 when I didn't make any changes.

UPDATE 8/14/2015: This appears to be an issue with CocoaPods and Extensions like a WatchKit or Today extension. It has been reported as Invalid archive produced when using "Archive" in Xcode 7 beta 5 (with watchkit extension) #4021 by another developer. It appears to be the root cause of this issue.

Environment:
- Xcode 7 Beta 5
- Today Extension
- Normal App
- CocoaPods 0.38.2 (Latest Released Version as of 9/22)
- AFNetworking Used in Extension & App


回答1:


It's an issue with CocoaPods v0.39.0.beta.4.

As described in CocoaPods GitHub the beta 3 of CocoaPods allows you to build archives as expected. Beta 4 has a bug preventing this from working.

Uninstall your previous CocoaPods version first

sudo gem uninstall cocoapods

and then do:

sudo gem install cocoapods -v 0.39.0.beta.3 --verbose

then

pod update

and you'll be able to build archives again as expected.




回答2:


I just confirmed today that this was a CocoaPods issue for me, specifically 4021. I tried as the other users on the issue and removed "copy pod resources" from my today extension target. Once that was removed I was able to package up an archive successfully in Xcode 7 Beta 5.

Hopefully this still works in the next beta and the GM...

UPDATE 9/22: This is the answer if you are using 0.38.2 of CocoaPods their latest Release version as of 9/22/2015. I was able to submit my app to the app store using Xcode 7 GM using this method.




回答3:


Finally it`s fixed in the latest stable Version 0.39.0:

So instead of uninstalling

sudo gem uninstall cocoapods

and reinstalling via

sudo gem install cocoapods

Also a simple

sudo gem update cocoapods

should fix it!




回答4:


I had the same issue when updated Xcode to Version 7.0 (7A220). And they said this issue is already tracked(Issue#4274)

finally,i fixed this issue with following steps: 1)clear all "Private Headers Folder Path" and "Public Headers Folder Path" in all the Pods Targets->Build Setting->Packaging 2)delete the "Copy Pods Resources" in our Targets->Build Phases.




回答5:


This can be caused by using CocoaPods 0.38.[0-2] and Xcode 7.

It works with an older version of CocoaPods:

$ gem install cocoapods -v "=0.37.2"
$ gem uninstall cocoapods # then select 0.38.[0-2]
$ pod update

(Additionally, I also had to clean my build folder and wipe the Pods folder before the pod update and make changes to the AFNetworing post install hook in my Podfile)

Further causes are discussed in Cannot generate iOS App archive in xcode.




回答6:


Works fine if you delete Copy Pod Resources from your extension. Though I have no idea what this could cause, my app worked, archived and went to review.




回答7:


If using Xcode 7 with cocoapods v.0.38.2. Try removing copy pod resources from your today extension target.



来源:https://stackoverflow.com/questions/32002764/xcode-7-will-not-build-a-valid-archive-from-the-same-project-that-builds-a-valid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!