twitter-kit-ios icon indicating copy to clipboard operation
twitter-kit-ios copied to clipboard

Change packaging form for proper handling of static frameworks using CocoaPods 1.4.0

Open DenTelezhkin opened this issue 7 years ago • 15 comments

Bug Report

  • TwitterKit/TwitterCore Version Number: 3.3.0/3.1.0
  • CocoaPods 1.4.0.rc.1

Hey!

This will be more of descriptive issue of things i think i found out today while integrating TwitterKit into my app.

My setup of a project is as follows: there is a framework, that contains most of the code, and app target which depends on it. I use CocoaPods for both targets, and integrate TwitterKit/TwitterCore into framework target.

When running the app, multiple warnings like this jump out in console:

objc[93428]: Class TWTRScribeService is implemented in both /Users/Denys/Library/Developer/CoreSimulator/Devices/CA2742B8-22F4-4C6B-8A09-8870838ACCEF/data/Containers/Bundle/Application/BAD2EE63-C5FF-4E07-A296-2BE29E4FB060/DocDebug.app/Frameworks/TwitterKit.framework/TwitterKit (0x1089ef148) and /Users/Denys/Library/Developer/CoreSimulator/Devices/CA2742B8-22F4-4C6B-8A09-8870838ACCEF/data/Containers/Bundle/Application/BAD2EE63-C5FF-4E07-A296-2BE29E4FB060/DocDebug.app/Frameworks/TwitterCore.framework/TwitterCore (0x108866f70). One of the two will be used. Which one is undefined.
objc[93428]: Class TWTRUserAuthRequestSigner is implemented in both /Users/Denys/Library/Developer/CoreSimulator/Devices/CA2742B8-22F4-4C6B-8A09-8870838ACCEF/data/Containers/Bundle/Application/BAD2EE63-C5FF-4E07-A296-2BE29E4FB060/DocDebug.app/Frameworks/TwitterKit.framework/TwitterKit (0x1089ef1c0) and /Users/Denys/Library/Developer/CoreSimulator/Devices/CA2742B8-22F4-4C6B-8A09-8870838ACCEF/data/Containers/Bundle/Application/BAD2EE63-C5FF-4E07-A296-2BE29E4FB060/DocDebug.app/Frameworks/TwitterCore.framework/TwitterCore (0x108866fe8). One of the two will be used. Which one is undefined.

After several hours of research i came into conclusion that reason for that is TwitterKit is compiled as static library and then imported into TwitterKit dynamic library, which is distributed using CocoaPods vendored_framework instruction. It seems that CocoaPods 1.4.0 introduces proper support for distributing static library without such shenanigans, as described in this blog post: https://github.com/CocoaPods/blog.cocoapods.org/pull/147/files

I'm not sure what the next steps would be and how PR to change this should be formed, as clearly this changes how framework can be distributed by Twitter team and requires some changes in Xcode projects e.t.c.

So this issue is more to start discussion about this and spread this information around. There are multiple issues on CocoaPods, that have some helpful information on this topic, just listing them here in case they are helpful:

https://github.com/CocoaPods/CocoaPods/issues/7126 https://github.com/CocoaPods/CocoaPods/issues/5768

DenTelezhkin avatar Dec 22 '17 18:12 DenTelezhkin

I want to also note, that this problem also exists if you install TwitterKit into main target of the application, so it's not exclusive to setup with framework target.

DenTelezhkin avatar Dec 23 '17 09:12 DenTelezhkin

I just install TwitterKit (3.3.0) using Cocoapods 1.3.1 on Xcode 9.2 and I can reproduce the same multiple warnings when the app start running.

@DenHeadless did you found a solution?

ggdiez avatar Jan 02 '18 17:01 ggdiez

No, unfortunately. Everything I've written in original description seems to be relevant and needs to be looked into by Twitter folks.

DenTelezhkin avatar Jan 02 '18 17:01 DenTelezhkin

The same problem for me. About 40-50 similar logs like: Class TWTRScribeService is implemented in both /private/var/containers/Bundle/Application/14EBC203-1D7F-4176-B6BA-4792C1512BBC/myApp.com/Frameworks/TwitterKit.framework/TwitterKit (0x105955330) and /private/var/containers/Bundle/Application/14EBC203-1D7F-4176-B6BA-4792C1512BBC/myApp.com/Frameworks/TwitterCore.framework/TwitterCore (0x10568cc88). One of the two will be used. Which one is undefined. Maybe someone knows, how can I just turn off these logs ?

Kharauzov avatar Jan 25 '18 14:01 Kharauzov

is there no progress on this issue? its been three months since this was open. Am facing the same issue

sushinoya avatar Mar 31 '18 15:03 sushinoya

Agree with you, guys. I have the same problem. How long should I wait updating TwitterKit?

svetlana-eatigo avatar Apr 12 '18 11:04 svetlana-eatigo

All I wanna say is that they don't really care about us.

diegotl avatar Apr 25 '18 23:04 diegotl

Still no update :<

sydneyagcaoili avatar Jun 01 '18 02:06 sydneyagcaoili

I am getting the same warnings

fbernaly avatar Jul 14 '18 01:07 fbernaly

same warnings :(

dsngeu avatar Jul 29 '18 06:07 dsngeu

fix needed

teanet avatar Aug 07 '18 14:08 teanet

same warnings, please help

auspicious99 avatar Sep 22 '18 15:09 auspicious99

I've fixed this by removing manually frameworks from OTHER_LDFLAGS from Pods-YourCoolTargetName.debug.xcconfig and Pods-YourCoolTargetName.release.xcconfig

astrokin avatar Sep 24 '18 13:09 astrokin

Confirming @astrokin's fix. OTHER_LDFLAGS in my Pods-<mytargetname>.debug.xcconfig and Pods-<mytargetname>.release.xcconfig files included:

-framework "TwitterCore" -framework "TwitterKit"

Changing both files to just:

-framework "TwitterKit"

eliminated the runtime warnings.

willdinkel avatar Sep 25 '18 14:09 willdinkel

is there no progress on this issue? its been three months since this was open. Am facing the same issue

shadow-boy avatar Sep 28 '18 15:09 shadow-boy