square / in-app-payments-flutter-plugin

Flutter Plugin for Square In-App Payments SDK
https://developer.squareup.com/docs
Apache License 2.0
340 stars 121 forks source link

Issue with running POD INSTALL for the Square API library #218

Closed DamonNomadJr closed 1 year ago

DamonNomadJr commented 1 year ago

Issue with running POD INSTALL for the Square API library

Flutter v 2.10.2 iOS v 12.0 Xcode v 14

Steps done:

flutter pub add square_in_app_payments
...
cd ios
...
pub install
...
Installing square_in_app_payments (1.6.1)
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (/Users/[redacted]/Desktop/Development/Projects/[redacted]/ios/Pods/SquareBuyerVerificationSDK/XCFrameworks/SquareBuyerVerificationSDK.xcframework and /Users/[redacted]/Desktop/Development/Projects/[redacted]/ios/Pods/SquareInAppPaymentsSDK/XCFrameworks/SquareInAppPaymentsSDK.xcframework)

Tried the following solution with no help:

in Podfile

target 'Runner' do
    use_frameworks! :linkage => :static
    use_modular_headers!

   flutter_install_all_ios_pods File.direname(Fire.realpath(__FILE__))
end

Generates the Pods but will get a linkage issue

dyld: Library not loaded: @rpath/SquareBuyerVerificationSDK.framework/SquareBuyerVerificationSDK
  Referenced from: /private/var/containers/Bundle/Application/187256F0-254C-410C-8671-589EDA2C90F3/Runner.app/Runner
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
(lldb)
CharmisG commented 1 year ago

May I know what iOS system are you running this code on? @DamonNomadJr

iNeedHelpX commented 1 year ago

yes I am getting a similar error when trying to run on simulator.

my system:

macbook air M1 2020
os: Ventura 13.3.1
ios simulator:16.4
Xcode version : 14.3

Err that i get when trying to run on ios simulator.


Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: DYLD 1 Library missing
Library not loaded: @rpath/ThreeDS_SDK.framework/ThreeDS_SDK
Referenced from: <EAF8E1BA-E3AE-372F-B629-A255114E419B> /Users/juliapak/Library/Developer/CoreSimulator/Devices/63D54239-A58D-4E24-8D89-901EA6209734/data/Containers/Bundle/Application/C6630B21-CF36-4CEA-897F-10128AF7D448/Runner.app/Frameworks/SquareBuyerVerificationSDK.framework/SquareBuyerVerificationSDK
Reason: tried: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/usr/lib/swift/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file, no dyld cache), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/usr/lib/swift/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file, no dyld cache), '/Appl
(terminated at launch; ignore backtrace)```
DamonNomadJr commented 1 year ago

@CharmisG Sorry for the late reply. I came to the understanding it is due to the Flutter version. The application we are building is based on Flutter 2.10~2.15 (tested on both), and it does not install the pods correctly, even though I can manually add the Pod libraries (not associated with Flutter) to include them in the library.

Upon upgrading to Flutter 3.10 it seems it downloads the Pod files correctly. However, this issue needs to be resolved for 2.15 as it was working before we requested the Square API team to update their flutter plugin!

As for the Hardware and Software:

Mac mini
Chip:    Apple M1
Memory:  8 GB
MacOS:   Ventura 13.3

Xcode
Version: 14.2(14C18)

Phone
Model:  iPhone XS
Soft:   14.8.1

Not for users: if you are doing use_frameworks :linkage => :static, it will not work! Flutter does not like the static binding of the Pods from what I understand. (I'm not an Apple Dev) I tried importing the library into the Runner->Targets(Runner)->Frameworks, Libraries, and Embedded Content will not work.

Another approach mentioned on a lot of forums was to remove the user_frameworks! line and it also won't work.

iNeedHelpX commented 1 year ago

@CharmisG Sorry for the late reply. I came to the understanding it is due to the Flutter version. The application we are building is based on Flutter 2.10~2.15 (tested on both), and it does not install the pods correctly, even though I can manually add the Pod libraries (not associated with Flutter) to include them in the library.

Upon upgrading to Flutter 3.10 it seems it downloads the Pod files correctly. However, this issue needs to be resolved for 2.15 as it was working before we requested the Square API team to update their flutter plugin!

As for the Hardware and Software:

Mac mini
Chip:    Apple M1
Memory:  8 GB
MacOS:   Ventura 13.3

Xcode
Version: 14.2(14C18)

Phone
Model:  iPhone XS
Soft:   14.8.1

Not for users: if you are doing use_frameworks :linkage => :static, it will not work! Flutter does not like the static binding of the Pods from what I understand. (I'm not an Apple Dev) I tried importing the library into the Runner->Targets(Runner)->Frameworks, Libraries, and Embedded Content will not work.

Another approach mentioned on a lot of forums was to remove the user_frameworks! line and it also won't work.

I actually solved this by doing what this commenter said: https://github.com/square/in-app-payments-flutter-plugin/issues/216#issuecomment-1510805934

I had a error at first so i had to do a fresh install of the ios folder. kinda a pain in the butt, but it works now

DamonNomadJr commented 1 year ago

Have you tried building a release bundle for upload with it? Also, can you explain what this does exactly? From what I can tell, you are invoking Flutter's iOS builder instead of XCodes if I am correct.

CharmisG commented 1 year ago

@DamonNomadJr closing this issue let us know if you face any other issue.