Skip to content

Instantly share code, notes, and snippets.

@npu3pak
Last active August 20, 2023 16:39
Show Gist options
  • Save npu3pak/108d8332a774289c08472d6fd85a1bbb to your computer and use it in GitHub Desktop.
Save npu3pak/108d8332a774289c08472d6fd85a1bbb to your computer and use it in GitHub Desktop.
This script fixes all TwitterKit related warnings in XCode 10.1. Add new run script build phase with this code:
readonly MODULEMAP="${PODS_ROOT}/TwitterCore/iOS/TwitterCore.framework/Modules/module.private.modulemap"
readonly HEADER="${PODS_ROOT}/TwitterCore/iOS/TwitterCore.framework/Headers/TwitterCore.h"
if ! grep -q "TwitterCore_Private" "${MODULEMAP}"; then
cat >"${MODULEMAP}" <<EOL
module TwitterCore_Private {
}
EOL
fi
if ! grep -q "TWTRColorUtil.h" "${HEADER}"; then
cat >>"${HEADER}" <<EOL
#import "TWTRColorUtil.h"
EOL
fi
@Headmast
Copy link

It doesn't in Xcode 10.2 and 11.0 beta (11M336w). I add this script at last position in Build Phases. Do you have any suggestions?

@npu3pak
Copy link
Author

npu3pak commented Jul 10, 2019

@Headmast you should run it before "Compile Sources" phase.

@Headmast
Copy link

Headmast commented Jul 11, 2019

@Headmast you should run it before "Compile Sources" phase.

Doesn't work too. Maybe it depends on 'TwitterKit', '3.4.2' and 'TwitterCore', '3.2.0' versions. Anyway, a working solution for me, add into podfile.

post_install do |installer|
    installer.aggregate_targets.each do |aggregate_target|
      aggregate_target.xcconfigs.each do |config_name, config_file|
        config_file.other_linker_flags[:frameworks].delete("TwitterCore")

        xcconfig_path = aggregate_target.xcconfig_path(config_name)
        config_file.save_as(xcconfig_path)
      end
    end
  end

Link from https://github.com/twitter-archive/twitter-kit-ios/issues/18#issuecomment-432633038

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment