Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 894
Polar Bear Avatar asked Aug 14 '15 05:08

Polar Bear


People also ask

How do I archive an Xcode project?

Navigate to your project's settings. Under iOS (or the target you want to build your app for) > Identity, you'll want to increment the Build number. For example, if the Build number was 1, you'll want to set it to 2. Then, in the top menu, under Product, click on Archive.

How do I import an archive into Xcode?

How do I import an archive into Xcode? Just drag the . xcarchive in Xcode and it will be added to the Xcode Organizer.

Where are Xcode Archives?

Open the Archives folder in Finder: Library > Developer > Xcode > Archives.


2 Answers

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.

like image 180
ehrpaulhardt Avatar answered Oct 29 '22 16:10

ehrpaulhardt


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.

like image 33
Polar Bear Avatar answered Oct 29 '22 15:10

Polar Bear