3

Given I don't need the bundle SKAdvisorResources because I don't use any voice advice or navigation, how can I avoid it ends up in my ipa?

I've added SKMaps to my project as pod dependency just adding pod 'ScoutMaps-iOS-SDK' to my Podfile.

The solution I've come up with is to add a custom script phase to my project which removes the bundle before it gets exported; this is safe if you want to update your pods but I don't really like, I'd prefer to specify some exclusion rule in my Podfile but I don't know if this is possible...

rm -rf "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SKAdvisorResources.bundle"
rm -rf "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SKAdvisorResources.bundle"
Alessio Nunzi
  • 91
  • 1
  • 6
  • Right now that should work - when updating the pod we'll look into making the SKAdvisorResources bundle an optional package – Ando Feb 03 '16 at 12:01
  • @Ando I've updated cocoapods to version 1.0.0 and now my workaround doesn't work. How long before a new version with the bundle as optional dependency? Do you have any suggestion for fix the workaround? – Alessio Nunzi May 30 '16 at 18:15

2 Answers2

2

I know this is an old question and probably you got a solution(or decided to use another library)

but just in case for future references

THIS WORKS ON MacOS for other systems you need to check your available tools find, sed

you can comment that line with something like this at your Podfile

post_install do |installer|    
    app_target = "your_target_goes_here"
    puts("* Commenting file `Pods-#{app_target}-resources.sh` line having `SKAdvisorResources.bundle`")
    system("find . -name \"Pods-#{app_target}-resources.sh\" -exec sed -i '' -e \"/SKAdvisorResources.bundle/s/^/#/\" {} +")
end

Lets add a little explanation here in case and update is needed xD

Explanation:

  • /SKAdvisorResources.bundle/ matches a line with SKAdvisorResources.bundle in it
  • s perform a substitution on the lines matched above
  • if something match, then will insert the hash character # at the beginning of the line ^
yeradis
  • 5,235
  • 5
  • 25
  • 26
1

Following @yeradis suggestion my final solution cycles through the aggregated list of targets defined in the podfile and apply the replacement to all file.

post_install do |installer|
    installer.aggregate_targets.each do |target|
        puts("* Commenting file `#{target.label}-resources.sh` lines having `SKAdvisorResources.bundle`")

        system("find . -name \"#{target.label}-resources.sh\" -exec sed -i '' -e \"/SKAdvisorResources.bundle/s/^/#/\" {} +")
    end
end

Note that target.label returns a string including the Pods- prefix

Alessio Nunzi
  • 91
  • 1
  • 6