Cocoapods: Use Xcode 10 recommended project settings

Created on 7 Nov 2017  ·  65Comments  ·  Source: CocoaPods/CocoaPods

Report

Related to #6863, issue not resolved in latest Xcode 9 release.

What did you do?

Run pod install on a project and then open it in Xcode 9.1

What did you expect to happen?

CocoaPods generates a project that doesn't have any warnings.

What happened instead?

A project that was generated with a suggestion to "Update to recommended settings", with the following suggestions:

screen shot 2017-11-06 at 5 54 35 pm

CocoaPods Environment

Stack

   CocoaPods : 1.4.0.beta.2
        Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
    RubyGems : 2.5.2
        Host : Mac OS X 10.13.1 (17B48)
       Xcode : 9.1 (9B55)
         Git : git version 2.13.6 (Apple Git-96)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ bf4673bf4f0343c44d5b1101004c66efd757c6ce

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.0
cocoapods-try         : 1.1.0

Most helpful comment

Cocoapods 1.5.3 / xcode 9.4

screen shot 2018-05-29 at 6 43 55 pm

All 65 comments

Same for me, I also tried deleting the Pods folder, as well as the .xcworkspace file and doing pod install

Can you please paste the diff when you apply the chances? I had tried to update project settings before but I see no diff.

0001-project-file-after-suggested-changes-by-Xcode.txt

Most of the changes are towards the bottom. There was some path changes, but the actual project settings are towards the bottom of the patch. I isolated this file by only doing the suggested upgrades to the pod project

@jhudsonWA most likely because you are running Xcode 9.1 you got outdated settings.

I do not have Xcode 9.1 installed. Can you please try cloning https://github.com/CocoaPods/Xcodeproj and then run ruby spec/fixtures/CommonBuildSettings/rebuild_from_xcode and make a PR with the updated settings?

Yep, will do

@jhudsonWA the file is present for me. Does not seem to be a submodule, are you sure you are pointing to latest master?

It was my fault. I cloned the wrong project. 👎 All fixed now. Submitted the PR

+1'ing this, cocoapods 1.3.1 is still generating projects without whole module optimization in xcode 9.1.

This is still an issue with Xcode 9.2 GM and Cocoapods 1.4.0.beta.2

This is still an issue in Xcode 9.2 (9C40b) and cocoapods 1.4.0.rc.1

We will try to take care of it before 1.4.0.rc.1 ships

@jhudsonWA @mrgrauel @freak4pc I am creating a brand new Xcode project and using 1.4.0.rc.1 and Xcode 9.2 (9C40b) and I do not see the warning. Does anyone have a sample app or better steps to repro this?

Using 9.2 GM and 1.4.0.rc.1 I no longer get the warning message.

Let me test a few things more because others with that configuration still got the warning.

Scratch that, closed Xcode and reopened and now i see the warnings.
screen shot 2018-01-17 at 4 39 27 pm

@jhudsonWA do you have Swift in your project? I was able to repro with a Swift pod in my project but I did not receive the same warnings as you.

Yes is primarily Swift based with a few Objective C files

These are the warnings I see:

screen shot 2018-01-17 at 4 45 26 pm

Hmmm I don't get those. Weird.

Hold on I think I am getting somewhere on this.

Nope, still failing to repro :|

@jhudsonWA can you paste the diff here of what settings change when you apply the new settings?

@jhudsonWA do you have multiple different configurations besides "Debug" and "Release"?

I am sorry I just cant get it to repro. Need a sample project for this.

@dnkoutso Yes I have multiple configurations besides Debug and Release. I'll try to create a sample.

@dnkoutso @jhudsonWA I think the repor issue is that you need to set the iOS to 11.

Running Xcode
Version 9.2 (9C40b)

I did the following:
1) Create a Single View App
2) pod init
3) replace with the following pod file

Notice that the pod iOS platform is not specified so you will get a default of iOS 11.2

target 'Warning' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Warning

  target 'WarningTests' do
    inherit! :search_paths
    # Pods for testing
    pod 'Kingfisher'
  end

end

4) pod install
5) open up the workspace

Notice the warning.

Still couldn't repro with my sample app. Let me try from scratch, wonder if tests is causing this?

I just did the exact steps above and I see 0 warnings

OK, i tried with a test target included for a new app, I can now repro but I do not see all the warnings that @jhudsonWA is seeing, only the one about Whole Module Optimization

Cool. I was about to send a project but I think you got it. Let me know if you need it still.

No matter if I'm using 1.3.1 or 1.4.0.rc.1 I am getting the same diff when I'm fixing the warnings in Xcode. I can split it into 3 parts.

  1. Turning on WMO for release builds:
 /* Begin PBXProject section */
        D41D8CD98F00B204E9800998ECF8427E /* Project object */ = {
            isa = PBXProject;
            attributes = {
                LastSwiftUpdateCheck = 0830;
-               LastUpgradeCheck = 0700;
+               LastUpgradeCheck = 0920;
(1700 lines)
                STRIP_INSTALLED_PRODUCT = NO;
+               SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
                SYMROOT = "${SRCROOT}/../build";
            };
            name = Release;
        };
  1. Clicking Convert Later without Remind Me option when asked for Swift migration (there were more entries, one for every target, I shortened it for brevity):
/* Begin PBXProject section */
        D41D8CD98F00B204E9800998ECF8427E /* Project object */ = {
            isa = PBXProject;
            attributes = {
                LastSwiftUpdateCheck = 0830;
                LastUpgradeCheck = 0700;
+               TargetAttributes = {
+                   0A32EF44FD55D2B9B4DE90E6889323C7 = {
+                       LastSwiftMigration = 0920;
+                   };
+                   DC54C98851E54D349520C786701A1845 = {
+                       LastSwiftMigration = 0920;
+                   };
+               };
            };
  1. Changes to project file structure - groups are now backed by folders. This is being made by Xcode in the project file when it does any of above changes. If I discard them I don't get warnings and everything works ok but I guess they are also nice to have as this will make project file more aligned with how Xcode is saving project files (also shortened it for brevity):
        9CC85CD2B1F82161F2BA03C770AEC420 /* MPVASTTrackingEvent.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MPVASTTrackingEvent.h; path = MoPubSDK/Internal/VAST/MPVASTTrackingEvent.h; sourceTree = "<group>"; };
-       9CDADA5DE785A54D5563D1BEE8485542 /* Expecta.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Expecta.framework; path = Expecta.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+       9CDADA5DE785A54D5563D1BEE8485542 /* Expecta.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Expecta.framework; sourceTree = BUILT_PRODUCTS_DIR; };
        9D055897D776BE42F4690B4275CDEBF8 /* FBSDKAppEventsDeviceInfo.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FBSDKAppEventsDeviceInfo.m; path = FBSDKCoreKit/FBSDKCoreKit/Internal/AppEvents/FBSDKAppEventsDeviceInfo.m; sourceTree = "<group>"; };
        9E1B18FB3FE76F9688FD824C23FF2539 /* [email protected] */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = "[email protected]"; path = "Resources/[email protected]"; sourceTree = "<group>"; };
(...)
        983591DAFCAB94CA58F00227742446C9 /* BFURL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = BFURL.h; path = Bolts/iOS/BFURL.h; sourceTree = "<group>"; };
-       983CD940AEC2A5AE00037B4B82738B4B /* SCBModel.xcmappingmodel */ = {isa = PBXFileReference; includeInIndex = 1; name = SCBModel.xcmappingmodel; path = ScbeiOS/DataModel/SCBModel.xcmappingmodel; sourceTree = "<group>"; };
+       983CD940AEC2A5AE00037B4B82738B4B /* SCBModel.xcmappingmodel */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = wrapper.xcmappingmodel; name = SCBModel.xcmappingmodel; path = ScbeiOS/DataModel/SCBModel.xcmappingmodel; sourceTree = "<group>"; };
        9852289588E9E2390C0566C1D6B8EBA8 /* EXPFloatTuple.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = EXPFloatTuple.h; path = Expecta/EXPFloatTuple.h; sourceTree = "<group>"; };
(...)
        C161E4EF89C4C54BFCE17E9E2971080D /* _FBSDKLoginRecoveryAttempter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _FBSDKLoginRecoveryAttempter.m; path = FBSDKLoginKit/FBSDKLoginKit/Internal/_FBSDKLoginRecoveryAttempter.m; sourceTree = "<group>"; };
        C16787ED0264EF6CF626F5AD9BD6BDB1 /* MPAnalyticsTracker.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MPAnalyticsTracker.m; path = MoPubSDK/Internal/Utility/MPAnalyticsTracker.m; sourceTree = "<group>"; };
-       C1892C6671CEA8D9260CA020BF8DC86A /* it.lproj */ = {isa = PBXFileReference; includeInIndex = 1; name = it.lproj; path = Resources/it.lproj; sourceTree = "<group>"; };
+       C1892C6671CEA8D9260CA020BF8DC86A /* it.lproj */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = folder; name = it.lproj; path = Resources/it.lproj; sourceTree = "<group>"; };
        C2354B973DC07B236011A6E9EF1CCB1A /* ContextMenu.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = ContextMenu.xcconfig; sourceTree = "<group>"; };
        C24A5E4BE62E2309F3373E0571F2DC6D /* BITCrashReportTextFormatterPrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = BITCrashReportTextFormatterPrivate.h; path = Classes/BITCrashReportTextFormatterPrivate.h; sourceTree = "<group>"; };
        C2842EB3BD20D60F13F8657C820D13A9 /* ADJPackageBuilder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ADJPackageBuilder.h; path = Adjust/ADJPackageBuilder.h; sourceTree = "<group>"; };
        C2CB838F56A2CEA5D832E5F39460572C /* MPCoreInstanceProvider.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MPCoreInstanceProvider.m; path = MoPubSDK/Internal/MPCoreInstanceProvider.m; sourceTree = "<group>"; };
        C30C4C24B397122A33DE29FA90088DEA /* Reachability-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Reachability-prefix.pch"; sourceTree = "<group>"; };
-       C30F67889C4F6E3EC153D7B78B3EF4A3 /* FBSDKCoreKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = FBSDKCoreKit.modulemap; sourceTree = "<group>"; };
+       C30F67889C4F6E3EC153D7B78B3EF4A3 /* FBSDKCoreKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = FBSDKCoreKit.modulemap; sourceTree = "<group>"; };
        C37F1ECA02F4AB265F78D6A339B31A35 /* FBSDKErrorRecoveryAttempter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FBSDKErrorRecoveryAttempter.m; path = FBSDKCoreKit/FBSDKCoreKit/Internal/ErrorRecovery/FBSDKErrorRecoveryAttempter.m; sourceTree = "<group>"; };
        C38AE58D40FDBF6E9FB891057626A5FA /* FBSDKServerConfiguration.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FBSDKServerConfiguration.m; path = FBSDKCoreKit/FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfiguration.m; sourceTree = "<group>"; };
(...)
-       D0C2BE7E4A8611F28D2926AA8CBAF6D4 /* JRSwizzle.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = JRSwizzle.framework; path = JRSwizzle.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+       D0C2BE7E4A8611F28D2926AA8CBAF6D4 /* JRSwizzle.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JRSwizzle.framework; sourceTree = BUILT_PRODUCTS_DIR; };
        D0C4B496C39E3AED49A219F207994BD5 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
        D0ED835145DF36A69022611C7D663349 /* MPAdPlacerInvocation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MPAdPlacerInvocation.m; path = "MoPubSDK/Native Ads/Internal/MPAdPlacerInvocation.m"; sourceTree = "<group>"; };
(1000 lines)
                7614387A74534D3111A00268E3782B65 /* World+DSL.h */,
                36CA60E0E4AED0CD2CABA78E62E1BDF9 /* World+DSL.swift */,
                361658182EAB1B815EE5DBD260E049F3 /* XCTestSuite+QuickTestSuiteBuilder.m */,
                4419F6C9B1195B9D77005533F91F5339 /* Support Files */,
            );
-           name = Quick;
            path = Quick;
            sourceTree = "<group>";
        };
        7A4BC1EBB5545E0FD91099904A82EE20 /* Frameworks */ = {
            isa = PBXGroup;
(50 lines)
                4C0273E96D2C5FF753A47F2CABF607DA /* JRSwizzle.m */,
                FF1B9E656B85D296ADCFC6623014985F /* Support Files */,
            );
-           name = JRSwizzle;
            path = JRSwizzle;
            sourceTree = "<group>";
        };
        829BF7FF9076628978EC7666A14B783E /* Support Files */ = {
            isa = PBXGroup;

After upgrading to CocoaPods 1.4 and runningpod update / pod install I still get "Update to recommended settings - Turn on Whole Module Optimization"

XCode Version 9.2 (9C40b)

Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target 'MyApp' do
    pod 'Alamofire', '= 4.6.0'
[...]
end

Will take care of this for 1.4.1 or 1.5.0 which will be a quick release.

I wonder if there is a possibility for CocoaPods to not override things like LastUpgradeCheck, LastSwiftUpdateCheck or LastSwiftMigration during integration to avoid issues like this in the future? Those properties don't affect the build in any way.

@piotr-tobolski we don't override them, we just create a new Pods.xcodeproj from scratch on every pod install

@segiddins I know, but it results in overriding all contents of this file including those values. I was thinking about reading those values from previous version if this file existed. Or maybe some DSL for setting those values from Podfile (that would be more an xcodeproj change). Neither of those solutions seem good though.

Will close once it lands.

Hey folks,

The issue happens for the HockeySDK pod still =/
Any guidance is very much appreciated.

I've attached a sample project that has the issue, too. Our podfile can be found here.

Again, thx in advance everyone.

Cheers!
Benjamin
TestReleasedCocoapods.zip

@TroubleMakerBen there is no cocoapods release with the changes from CocoaPods/Xcodeproj#541 yet

Xcodeproj 1.5.5 is out please update if you use bundler or wait for the next version of cocoapods that bumps the version itself.

https://github.com/CocoaPods/Xcodeproj/blob/master/CHANGELOG.md#155-2018-02-02

@dnkoutso Unfortunately it solved only part of the problem. I have updated the xcodeproj and there is no warning about changing build settings but there is still warning about Swift migration.

@joshfriend I completely missed that, sorry!

Cocoapods 1.5.3 / xcode 9.4

screen shot 2018-05-29 at 6 43 55 pm

+1: Same here

+1 for @chrisvanbuskirk issue

+1 , same.

Guys, please just leave a :+1: reaction on the toplevel comment, you don't need to leave individual comments just saying "+1 on this". Everyone watching the issue just gets spammed for no reason when you do this.

+1 to what @joshfriend said

ffs 🤦‍♂️

Jokes aside, two weeks passed, will there be a fix? :) Thanks!

@dnkoutso can this please be reopened?

Hey guys, any updates on this? Every time I run pod install the build breaks for me because of this error. I'm using Texture in my project which has it's own issue that's causing this build error: https://github.com/TextureGroup/Texture/issues/969
But this is fixed by updating the Pods project to the recommended settings by Xcode, so I think a fix in CocoaPods is also necessary.

Uhm this should be just a warning... Can't imagine this actually breaking a build. Are you sure its related?

Yes, I'm sure. It is indeed just a warning from Xcode, but the incorrect build settings are causing a build error in Texture, which relies on build settings to be properly set. The build error goes away as soon as I update the Pods project to the recommended Xcode settings, so I'm 100% positive that fixing this would prevent the build error altogether. This might also be the case for other third-party libraries that rely on the recommended build settings, but so far I've only seen it in Texture.

@segiddins @dnkoutso Lack of the "Whole Module" compilation mode setting is still triggering this warning using 1.6.0.beta.1. Xcode wants the setting for the Release configuration set on the Pods project itself, not just all of the targets.

is this with Xcode 10 or Xcode 9?

Ah, that would be Xcode 10, no warnings at all under Xcode 9.4.1.

great will update this issue title

@jshier I see these warnings in 9.4.1 as well

@jshier which Xcode 10 beta are you on?

b6. I'm also now seeing this on Xcode 9.4.1 for the same setting. The easiest way to see the suggested changes is to select the project in Xcode and go to Editor -> Validate and see what's suggested. Both Xcode 9.4.1 and Xcode 10b6 suggest the whole module setting for the release configuration of the Pods project.

Thanks, weirdly enough I do not see a diff when I update the settings in the Xcodeproj gem...will investigate further.

Still an issue, brand new project, 1 cocoapod installed, Xcode Version 9.4.1 (9F2000)

The whole module optimization setting is better tracked in #8063, so I'm going to close this in favor of that issue. If there are other warnings besides the whole module optimization setting, please open another issue 🙏

Was this page helpful?
0 / 5 - 0 ratings