14

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

Polar Bear
  • 918
  • 2
  • 7
  • 19
  • Where the extensions go is determined by the "Installation Directory" build setting. However, I'm having the same issue and setting that to "/Applications" for the extensions did put them in the same spot as Xcode 6, but the archive still lands in "Other Utils". – Adrian Schönig Aug 14 '15 at 07:35
  • I am having a similar issue but I have a framework at `/Library/Frameworks`. – Porter Hoskins Aug 14 '15 at 16:19
  • The real fix is to downgrade cocoapods to 0.39.0 beta 3 - beta 4 has a bug which is causing your issue. See http://stackoverflow.com/a/32654636/1103584 – DiscDev Sep 22 '15 at 15:20
  • The issue as reported was with the Released 0.38.2 version of Cocoapods. Moving to a beta Cocoapods which has not been released appears to be a solution as well but if you want to use a Released version of Cocoapods the accepted answer is the only way until they Release 0.39.x with it fixed. – Polar Bear Sep 23 '15 at 04:21

7 Answers7

16

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.

DiscDev
  • 38,652
  • 20
  • 117
  • 133
ehrpaulhardt
  • 1,607
  • 12
  • 19
  • thanks. worked great for me too after I ran 'sudo gem uninstall cocoapods' to remove beta 4. – jlichti Sep 22 '15 at 15:15
  • this should be marked as the answer - the currently accepted answer doesn't provide a solution - I had the same problem and confirmed that downgrading to beta 3 fixed my project and I can now build archives successfully. – DiscDev Sep 22 '15 at 15:20
  • 1
    For what it's worth I was running 0.38.2 (released) and had this issue, but uninstalling that and installing 0.39.0.beta.3 like above fixed it. Yay package managers for making life easy. – Tom Kidd Sep 25 '15 at 16:00
  • The problem with this answer is that it requires you to update all of your cocoapods. Fortunately I was able to use this solution: http://stackoverflow.com/a/32655151/3344977 – user3344977 Oct 02 '15 at 05:19
  • does this problem exist with ```CocoaPods 0.39.0.rc.1``` as well? – swalkner Oct 09 '15 at 07:38
12

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.

Polar Bear
  • 918
  • 2
  • 7
  • 19
  • Saved me a lot of time, thanks! I am using Xcode 7 GM – estemendoza Sep 12 '15 at 17:11
  • While this is an "answer" the real answer is that cocoapods v0.39.0 beta 4 has a bug, and downgrading to beta 3 will fix it: http://stackoverflow.com/a/32654636/1103584 – DiscDev Sep 22 '15 at 15:19
  • Its the answer if you only use the Released versions of Cocoapods. They have not released a version with a fix that is not a beta and in fact broke the fix in a later beta. Once Cocoapods releases a version with the fix the solution will be to update Cocoapods to the new released version until then this is the only solution if you want to use a released version of Cocoapods. – Polar Bear Sep 23 '15 at 04:18
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!

niggeulimann
  • 688
  • 6
  • 15
1

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.

archerLj
  • 199
  • 1
  • 2
  • 14
0

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.

Community
  • 1
  • 1
Adrian Schönig
  • 1,786
  • 18
  • 26
  • I wish I could use this solution but cocoapods error out on `pod update` on version `0.37.2` – Porter Hoskins Aug 14 '15 at 15:47
  • Thanks, but you have to use version 0.38.2 to make an archive if you use AFNetworkin otherwise https://github.com/CocoaPods/CocoaPods/issues/3738 occurs. I'll make a sample project, maybe I need to submit another cocoapod bug. Using 0.37.2 will not work with Xcode 7 for my purposes. Thanks for the info. Ill post the bug report once written. – Polar Bear Aug 14 '15 at 22:39
  • Reverting to 0.37.2 worked for me even though I'm using AFNetworking as well. Definitely a good idea to file a bug report with Cocoapods. Good luck! – Adrian Schönig Aug 14 '15 at 22:45
  • @AdrianSchönig Thanks, if you have a single app there doesn't appear to be an issue with AFNetworking and cocoapods, I forgot to add that detail. Its only an issue if you have an extension which needs to also use AFNetworking. Does you app have an extension with AFNetworking being used that works on 0.37.2? – Polar Bear Aug 15 '15 at 02:12
  • @PorterHoskins it looks like there is a CocoaPods bug for this already written up as [Invalid archive produced when using "Archive" in Xcode 7 beta 5 (with watchkit extension) #4021](https://github.com/CocoaPods/CocoaPods/issues/4021). – Polar Bear Aug 15 '15 at 03:32
  • Yes, I do have a Today extension and a WatchOS 1 extension which both use AFNetworking and that works fine for me in 0.37.2. – Adrian Schönig Aug 15 '15 at 08:08
  • Just in case, here's the [post_install hook from my Podfile](https://gist.github.com/nighthawk/ca9f31f120fb04172121.) – Adrian Schönig Aug 15 '15 at 08:10
  • @AdrianSchönig Thanks for the post_install hook example. I tried that one out but when I use 0.37.2 with it I get an [error](http://pastebin.com/jzUVurtg). I tried modifying it some more but I can't seem to get past that error. My Podfile that works with 0.38.2 is [here](https://gist.github.com/TravisCrist/027e92ff5e1a7724eb27). The updated Podfile I tried to use which produces the error is identical to yours, I just replaced MYAPPNAME with my app name. I also tried adding to deduplicate_targets: false to my config.yaml file and I still got the same error. Any ideas? Thanks! – Polar Bear Aug 18 '15 at 04:22
0

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.

Yaroslav
  • 2,435
  • 1
  • 19
  • 36
0

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

CoderPug
  • 908
  • 9
  • 19