touren / twitter-kit-ios

Twitter Kit is a native SDK to include Twitter content inside mobile apps.
Apache License 2.0
110 stars 80 forks source link

How to use TwitterCore.framework #6

Closed kakaluo closed 4 years ago

kakaluo commented 5 years ago

I run ./build.sh and build TwitterKit.framwork successfully(I have changed to static library),but I got many errors after importing TwitterKit.framwork and TwitterCore.framework(original).

Expected behavior

Build my project successfully.

Actual behavior

Got many errors: duplicate symbol '_OBJCCLASS$_TWTRUserAuthRequestSigner' in: /Users/myproject/framework/TwitterSDK/TwitterKit.framework/TwitterKit(TWTRUserAuthRequestSigner.o) /Users/myproject/framework/TwitterSDK/TwitterCore.framework/TwitterCore(TWTRUserAuthRequestSigner.o) duplicate symbol '_OBJCMETACLASS$_TWTRUserAuthRequestSigner' in: /Users/myproject/framework/TwitterSDK/TwitterKit.framework/TwitterKit(TWTRUserAuthRequestSigner.o) /Users/myproject/framework/TwitterSDK/TwitterCore.framework/TwitterCore(TWTRUserAuthRequestSigner.o) duplicate symbol '_OBJCCLASS$_TWTRSecItemWrapper' in: /Users/myproject/framework/TwitterSDK/TwitterKit.framework/TwitterKit(TWTRSecItemWrapper.o) /Users/myproject/framework/TwitterSDK/TwitterCore.framework/TwitterCore(TWTRSecItemWrapper.o)

Steps to reproduce the behavior

However, If I remove TwitterCore.framework(remove reference) the project run well. If I remove TwitterCore.framework in finder, it procuced 'TwitterCore/TwitterCore.h' file not found.

touren commented 4 years ago

The reason is, in the original project, both TwitterCore.framework and TwitterKit.framework are using the same static library TwitterCore.a. Only use pod 'TwitterKit5', it will include the TwitterCore and it could be build and run, although there will be a lot of warnings when you run the project. Some workaround is here https://github.com/twitter-archive/twitter-kit-ios/issues/91

If you want to use your own TwitterKit.zip, you could

  1. upload the TwitterKit.zip file somewhere and get a URL points to it.
  2. Change your podspec file as: s.source = { :http => "<URL created in step 1>" }
  3. Change your Podfile as: pod "TwitterKit" ==> pod "TwitterKit", :podspec => "<URL point to the podspec created in step 2>"
kakaluo commented 4 years ago

Thanks, everything is ok after removing TwitterCore.a in TwitterKit project!