square / in-app-payments-flutter-plugin

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

Support for M1 Macs #226

Closed supposedlysam-bb closed 1 year ago

supposedlysam-bb commented 1 year ago

Describe your question

Your README states, "Currently, this plugin will work only on Mac with Intel processor. This will not work on Mac with M1 chip."

Do you all have an estimate on when support for Macs with M1 (and above) will work?

abdulmoiz02 commented 1 year ago

@supposedlysam-bb does it mean i can not build ios app using mac m1 using this plugin?

CharmisG commented 1 year ago

@supposedlysam-bb @abdulmoiz02 The Plugin supports the Mac M1. We have updated the README file. Thank you for highlighting it.

supposedlysam-bb commented 1 year ago

Thank you!

Here is the diff for anyone who is curious of what changed: https://github.com/square/in-app-payments-flutter-plugin/compare/3e0c6c...3eb0488

abdulmoiz02 commented 1 year ago

@supposedlysam-bb can you please guide me how to update pod files because my app still crashes while building ios app on mac m1. while running pod install i get this "Installing square_in_app_payments (1.6.1)" is it right version if not how to update it Thanks.

supposedlysam-bb commented 1 year ago

@abdulmoiz02 I actually don't have an M1 to test on (although when we push it through CI it will have to build there). Do you have a stacktrace / log output that you can provide that tells what errors you're running into?

In general, after running flutter pub get you just need to cd into your ios folder and run pod update. Then you should be able to build/run your app for iOS.

abdulmoiz02 commented 1 year ago

Yes i have tried flutter clean,flutter pub get, cd ios,pod install. Andriod build is working fine but Ios build crashes as soon app opens. This is the error i get on xcode:

dyld[84569]: Library not loaded: @rpath/ThreeDS_SDK.framework/ThreeDS_SDK Referenced from: /Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/SquareBuyerVerificationSDK.framework/SquareBuyerVerificationSDK Reason: tried: '/Users/abdulmoiz/Library/Developer/Xcode/DerivedData/Runner-amdkvhkseetmdbggqbiucprvksrz/Build/Products/Debug-iphonesimulator/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/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), '/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), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/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), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ThreeDS_SDK.framework/ThreeDS_SDK' (no such file)Library not loaded: @rpath/CorePaymentCard.framework/CorePaymentCard Referenced from: <9CBFF902-6672-33E7-A883-8A5A47C75573> /Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDK Reason: tried: '/Users/abdulmoiz/Library/Developer/Xcode/DerivedData/Runner-amdkvhkseetmdbggqbiucprvksrz/Build/Products/Debug-iphonesimulator/CorePaymentCard.framework/CorePaymentCard' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/CorePaymentCard.framework/CorePaymentCard' (no such file), '/usr/lib/swift/CorePaymentCard.framework/CorePaymentCard' (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/CorePaymentCard.framework/CorePaymentCard' (no such file), '/usr/lib/swift/CorePaymentCard.framework/CorePaymentCard' (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/CorePaymentCard.framework/CorePaymentCard' (no such file), '/usr/lib/swift/CorePaymentCard.framework/CorePaymentCard' (no such file, no dyld cache), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/CorePaymentCard.framework/CorePaymentCard' (no such file), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/CorePaymentCard.framework/CorePaymentCard' (no such file), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/CorePaymentCard.framework/CorePaymentCard' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/CorePaymentCard.framework/CorePaymentCard' (no such file), '/usr/lib/swift/CorePaymentCard.framework/CorePaymentCard' (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/CorePaymentCard.framework/CorePaymentCard' (no such file), '/usr/lib/swift/CorePaymentCard.framework/CorePaymentCard' (no such file, no dyld cache), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/CorePaymentCard.framework/CorePaymentCard' (no such file), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/CorePaymentCard.framework/CorePaymentCard' (no such file), '/Users/abdulmoiz/Library/Developer/CoreSimulator/Devices/0B0F31A2-36B4-4C53-AC47-C44038EE582B/data/Containers/Bundle/Application/4EF0F668-3593-4E26-B652-C7F0A9A32388/Runner.app/Frameworks/CorePaymentCard.framework/CorePaymentCard' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CorePaymentCard.framework/CorePaymentCard' (no such file) Message from debugger: Terminated due to signal 6

CharmisG commented 1 year ago

@abdulmoiz02 Have you follow this below steps ? 1)Open your iOS project Runner.xcodeproj with Xcode. 2) Set the iOS Deployment Target to 12.0 or above. 3) Add an In-App Payments SDK build phase: => Open Runner.xcworkspace in Xcode. => In the Build Phases tab for your application target, click the + button at the top of the pane. => Select New Run Script Phase. => Paste the following into the editor panel of the new run script: FRAMEWORKS="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}" "${FRAMEWORKS}/SquareInAppPaymentsSDK.framework/setup"

abdulmoiz02 commented 1 year ago

getting this error Command PhaseScriptExecution failed with a nonzero exit code

image
CharmisG commented 1 year ago

@abdulmoiz02

To run the app in the simulator add "arm64" to "Excluded Architectures" in the Build Settings of both the project and the Pods project. Remove it when creating a build or archiving the app on the device.

If this solution doesn't work for you just let us know which Xcode version do you have?

abdulmoiz02 commented 1 year ago

Xcode 14.3.1 Build version 14E300c

image
CharmisG commented 1 year ago

@abdulmoiz02

Adding '-f' to the highlighted line in this file solved my problem. you can try it /ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh

if [ -L "${source}" ]; then echo "Symlinked..." source="$(readlink -f "${source}")" fi

abdulmoiz02 commented 1 year ago

it was already there

image
CharmisG commented 1 year ago

@abdulmoiz02

As of the update this issue is a result of Xcode 14.3 breaking the integration with CocoaPods. The solution to date is to update to the latest CocoaPods version (1.12.1) and run pod install .

Please follow the below steps to update CocoaPods:

If you have installed it using homebrew, you can run, brew update Brew Upgrade CocoaPods If you installed it using Gem, run gem install cocoapods again

Please run pod install after installing cocoapods.

abdulmoiz02 commented 1 year ago

already CocoaPods version (1.12.1) is installed. I even made new project ran it working fine and than i only add this library ran pub get and than in ios folder i ran pod install it was installed successfully. This was output: Installing SquareBuyerVerificationSDK (1.6.1) Installing SquareInAppPaymentsSDK (1.6.1) Installing square_in_app_payments (1.6.1)

After that when i ran it again app build successfully than crashes immediately. If there is another solution please let me know.

CharmisG commented 1 year ago

@abdulmoiz02 Can you double check that you followed the steps https://github.com/square/in-app-payments-flutter-plugin/issues/226#issuecomment-1674204206 ?

supposedlysam-bb commented 1 year ago

@abdulmoiz02 make sure you move the 'copy script step' AFTER the step where you get your pods. This one got me as well.

supposedlysam-bb commented 1 year ago

image

abdulmoiz02 commented 1 year ago

in which pod can you please send full screen shot ? @supposedlysam-bb

image
supposedlysam-bb commented 1 year ago

@abdulmoiz02 It's in your Runner>Runner Target>Build Phases, not in your Pods. image

abdulmoiz02 commented 1 year ago

It worked now app is working fine on IOS . You are great person thanks for your help and time. Both of you