ioscocoapodsskmaps

How can I exclude SKAdvisorResources.bundle from being copied within the app?


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"

Solution

  • 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