Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running pod update changes Pods build settings

Tags:

ios

cocoapods

When I run

pod upate

against my Podfile certain Build Settings for Architectures section for Pods project are changed:

  1. Supported Platforms changes to OS X (from iOS)
  2. Build Active Architectures Only changes to Yes (from No)
  3. Base SDK changes to No SDK (latest OS X) from Latest iOS

I don't know why it's changing that. Could it be something I'm having (or not having) in my podspec file for my dependencies? Here is an example of one of my podspec files:

Pod::Spec.new do |spec|
  spec.name                  = 'pi-ios-sdk'
  spec.version               = '1.2.0'
  spec.license               = { :type => 'Copyright', :text => 'Copyright 2014 <...>. All rights reserved.' }
  spec.homepage              = 'http://<...>.com/'
  spec.authors               = '<...> Grid Mobile Frameworks Team'
  spec.summary               = '<...> Identity authentication GRID projects.'
  spec.description           = 'The <...> Identity Client iOS SDK framework (Pi-ios-client) assists in accessing the services provided by the <...> Identity API.'
  spec.ios.deployment_target = '7.1'
  spec.requires_arc          = true
  spec.source                = { :git => 'ssh://git@devops-tools.<...>.com/mp/pi-ios-sdk.git', :tag => 'tag/1.2.0' }
  spec.source_files          = 'framework/src/xcode/Pi-ios-client/*.{h,m}'
  spec.header_dir            = 'Pi-ios-client'
  spec.exclude_files         = 'framework/src/xcode/Pi-ios-client/PGMPiTokenRefreshOperationTests.m'
  spec.ios.frameworks        = 'Foundation', 'UIKit'
end

And my Podfile:

platform :ios, "7.1"

target "CourseListClient" do
  pod 'core-ios-sdk', '1.2.0'
  pod 'pi-ios-sdk', '1.2.0'
  pod 'classroom-ios-library', '0.1.0-SNAPSHOT'
end

target "CourseListClientTests" do
  pod 'core-ios-sdk', '1.2.0'
  pod 'pi-ios-sdk', '1.2.0'
  pod 'classroom-ios-library', '0.1.0-SNAPSHOT'
end

I'm thinking - having those same dependencies for test target is probably unnecessary, but what else do I need to change? Thank you.

like image 264
rich Avatar asked Oct 07 '14 21:10

rich


People also ask

What is the difference between POD install and pod update?

The difference between pod install and pod update lies in how they interact with the Podfile. lock file. This file is used to store the exact version of each pod that is currently installed in your project.

What does POD repo update do?

cocoapods-repo-update is a CocoaPods plugin that checks your dependencies when you run pod install and updates the local specs repositories if needed.

How do you update project pods?

Use pod install to install new pods in your project. Even if you already have a Podfile and ran pod install before; so even if you are just adding/removing pods to a project already using CocoaPods. Use pod update [PODNAME] only when you want to update pods to a newer version.


1 Answers

add this at the end of your Podfile :

post_install do |installer_representation|
    projectSDK = nil

    puts"Updating all of the POD targets to not default to ONLY_ACTIVE_ARCH for debug"
    installer_representation.project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            if projectSDK.nil?
                projectSDK = config.build_settings['SDKROOT']
            end
        end
    end
    puts "Updating ONLY_ACTIVE_ARCH for the project, as well. While the project settings aren't supposed to matter, I've not found that to be the case."
    puts "Also setting the base SDK of the project to match that of the targets (doesn't matter which one); otherwise it defaults to No SDK (Latest OS X)"
    installer_representation.project.build_configurations.each do |config|
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        config.build_settings['SDKROOT'] = projectSDK
    end
end

source: Supported platforms, base SDK, build active architecture only settings reverted after pod update

if you are using the latest gem (gem install cocoapods --pre), replace the 2 ".project" above by ".pods_project"

regards

like image 102
altagir Avatar answered Oct 20 '22 05:10

altagir