robotmedia / RMStore

A lightweight iOS library for In-App Purchases
Apache License 2.0
2.43k stars 450 forks source link

Support dynamic libraries #170

Open sust86 opened 8 years ago

sust86 commented 8 years ago

For receipt verification it's required to add 'RMStore/AppReceiptVerificator' pod. This requires OpenSSL and will automatically add OpenSSL as a pod. The OpenSSL library RMStoreVerifcation depends on doesn't work as dynamic library. Adding use_frameworks! in the Podfile will result in an error:

[!] The 'Pods-appname' target has transitive dependencies that include static binaries: (/Users/user/Development/appname.ios/Pods/OpenSSL/lib/libcrypto.a and /Users/user/Development/appname.ios/Pods/OpenSSL/lib/libssl.a)

I switched to OpenSSL-Universal (https://github.com/krzyzanowskim/OpenSSL) which works when using dynamic libraries.

Can we update RMStores podspec file to use OpenSSL-Universal instead of OpenSSL ?

sust86 commented 8 years ago

I'm not 100% sure what the issue here is. I tried to use a local RMStore podspec where I tried to use OpenSSL-Universal. I'll receive the same static binary error. However, removing the dependency and adding the OpenSSL library explicitly in my pods will work.

tschmitz commented 8 years ago

I'm running into the same problem. @sust86 How did you work around this?

sust86 commented 8 years ago

Unfortunately I don't have a nice solution but I found a way to use the ReceiptVerificator with dynamic libraries for now. I'm no longer including RMStore/AppReceiptVerificator in my pods. Instead I'm including OpenSSL explicitly in my Pods and adding the AppReceiptVerificator part manually to my project. (I'm still using RMStore via pods)

philwebster commented 8 years ago

I got this working by using OpenSSL-iOS and changing the subspec for AppReceiptVerificator to this:

  s.subspec 'AppReceiptVerificator' do |arv|
    arv.dependency 'RMStore/Core'
    arv.platform = :ios, '7.0'
    arv.source_files = 'RMStore/Optional/RMStoreAppReceiptVerificator.{h,m}', 'RMStore/Optional/RMAppReceipt.{h,m}'
    arv.dependency 'OpenSSL-iOS'

    arv.vendored_libraries = '${PODS_ROOT}/OpenSSL-iOS/libcrypto.a', '${PODS_ROOT}/OpenSSL-iOS/libssl.a'
    arv.libraries = 'ssl', 'crypto'
    arv.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/OpenSSL-iOS/openssl/**", 'LIBRARY_SEARCH_PATHS' => "${PODS_ROOT}/OpenSSL-iOS/" }
  end

However, I'm not sure this is the right approach. Any guidance is welcome.

scottfister commented 8 years ago

Would love a proper fix to this, it's blocking us from being able to change to use_frameworks! for Swift code :)

bb-git commented 8 years ago

subscribing

Sjoerdjanssenen commented 7 years ago

Any updates on this?

Pwyll28 commented 7 years ago

Still no update ?