omise / omise-ios

Omise iOS SDK
https://www.opn.ooo
MIT License
74 stars 36 forks source link

Omise 3.7.1 (XCode 12.1) -- Previous Solutions Not Working #115

Closed jhareinger11 closed 3 years ago

jhareinger11 commented 3 years ago

I've tried the previous solutions used in other threads, including running the cleaning Derived Data, running scripts, etc., and none are working.

I am receiving the following message after running (carthage update --platform iOS --cache-builds):

Building scheme "OmiseSDK" in OmiseSDK.xcodeproj Build Failed Task failed with exit code 1: /usr/bin/xcrun lipo -create /Users/jhareinger/Library/Caches/org.carthage.CarthageKit/DerivedData/12.1_12A7403/omise-ios/v3.7.1/Build/Intermediates.noindex/ArchiveIntermediates/OmiseSDK/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OmiseSDK.framework/OmiseSDK /Users/jhareinger/Library/Caches/org.carthage.CarthageKit/DerivedData/12.1_12A7403/omise-ios/v3.7.1/Build/Products/Release-iphonesimulator/OmiseSDK.framework/OmiseSDK -output /Users/jhareinger/Documents/proj/Carthage/Build/iOS/OmiseSDK.framework/OmiseSDK

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/yf/ntpxp9sx213bn11wxv0vzj5r0000gn/T/carthage-xcodebuild.xtUwJP.log

igroomgrim commented 3 years ago

Do you try this workaround yet?

jhareinger11 commented 3 years ago

Yes, that solution does work to run a simulator, but I am unable to upload to the app store. I receive this message:

Code signing "OmiseSDK.framework" failed.

jhareinger11 commented 3 years ago

Also, to add context:

General > Frameworks, Libraries, and Embedded Content > OmiseSDK.framework = Embed Without Signing

Build Phases > Embed Frameworks > Copy only when installing is unchecked and OmiseSDk.framework is added

igroomgrim commented 3 years ago

At first, could you check an environment version? I trying to create a new project with

Step to produce

jhareinger11 commented 3 years ago

Thank you for your help.

I have no problem with the simulator or real devices, but I am still getting the same error as before when I try to deploy to the apps tore. I have tried all of the above.

For additional information, I had no issues prior to updating xcode and omise. I set deployment target of IOS 12. The only framework added via carthage is Omise. Also, for the architecture, this is the setup for the project, target and pods:

Screen Shot 2020-11-13 at 4 20 53 PM
jhareinger11 commented 3 years ago

There are so many issues with Carthage and it appears that others are having to utilize workarounds. Would it be possible to add another installation method such as CocoaPods?

igroomgrim commented 3 years ago

We do not support CocoaPods yet.

jhareinger11 commented 3 years ago

Ok, well is there a solution using Carthage? I cannot upload the app to the app store using the workaround suggested

igroomgrim commented 3 years ago

Also, to add context:

General > Frameworks, Libraries, and Embedded Content > OmiseSDK.framework = Embed Without Signing

Build Phases > Embed Frameworks > Copy only when installing is unchecked and OmiseSDk.framework is added

Do you try with Embed & Sign yet? ss

jhareinger11 commented 3 years ago

Yes, i have done all the above:

Screen Shot 2020-11-13 at 6 04 40 PM Screen Shot 2020-11-13 at 6 04 50 PM
jhareinger11 commented 3 years ago
Screen Shot 2020-11-13 at 6 04 23 PM
igroomgrim commented 3 years ago

You still got the error Code signing "OmiseSDK.framework" failed.? If yes, could you look at this workaround

acrabb commented 3 years ago

Any update on when a legitimate fix will become available? This is blocking our development.

jhareinger11 commented 3 years ago

So I managed to get it to work initially, but I updated XCode to 12.2 and now i'm running into issues again. I am now getting a "Swift Compiler Error: Module compiled with Swift 5.3 cannot be imported by the Swift 5.3.1 compiler"

The workarounds/"solutions" are very specific and thus are very short-term solutions. Could Omise please create a solution for Omise 3.8.0 (XCode 12.2) or please get rid of Carthage altogether -- it's likely to get worse from here given the coming changes and it'd be great to have an alternative option.

I have tried all previous solutions, removed carthage, deleted derived data and cleaned, then tried it all again. I am still getting the same error.

igroomgrim commented 3 years ago

Could you try this workaround without using Carthage? This workaround let we can build OmiseSDK.xcframework and just copy into your project

  1. use xcodebuild archive SDK for devices

    xcodebuild archive \
    -scheme OmiseSDK \
    -archivePath ~/YourOutputLocation/OmiseSDK-iphoneos.xcarchive \
    -sdk iphoneos \
    SKIP_INSTALL=NO \
    BITCODE_GENERATION_MODE=bitcode \
    OTHER_CFLAGS="-fembed-bitcode" \
    BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
    ONLY_ACTIVE_ARCH=NO
  2. combine them both in xcframework

    xcodebuild -create-xcframework \
    -framework ~/YourOutputLocation/OmiseSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/OmiseSDK.framework \
    -framework ~/YourOutputLocation/OmiseSDK-iphoneos.xcarchive/Products/Library/Frameworks/OmiseSDK.framework \
    -output ~/YourOutputLocation/OmiseSDK.xcframework
  3. drag and drop OmiseSDK.xcframework into your application project and select Copy items if needed

  4. in app targets Frameworks, Libraries, and Embeded content choose Embed & Sign

🙇

igroomgrim commented 3 years ago

Or you can try again with this script

#!/usr/bin/env bash

# carthage.sh
# Usage example: ./carthage.sh build --platform iOS

set -euo pipefail

xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT

# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.
for simulator in iphonesimulator appletvsimulator; do
    echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_${simulator}__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig
done
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(PLATFORM_NAME)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"
cat $XCODE_XCCONFIG_FILE
carthage "$@"

If you got an error like The file “Cartfile.resolved” couldn’t be opened because there is no such file. you can try again with ./carthage.sh update --platform iOS

jhareinger11 commented 3 years ago

Creating the xcframework would be great, but it comes with other issues that fail:

Either I used New Build Settings and include the xcframework, then get the following message: Multiple commands produce '/Users/jhareinger/Library/Developer/Xcode/DerivedData/Project-dnx-acpbwukpxzmsfjariuwhmruhhanl/Build/Products/Release-iphonesimulator/Project-dnx.app/Info.plist': 1) Target 'Project-dnx' (project 'Project-dnx') has copy command from '/Users/jhareinger/Downloads/Project-dnx/Project-dnx/Info.plist' to '/Users/jhareinger/Library/Developer/Xcode/DerivedData/Project-dnx-acpbwukpxzmsfjariuwhmruhhanl/Build/Products/Release-iphonesimulator/Project-dnx.app/Info.plist' 2) Target 'Project' (project 'Project-dnx') has process command with output '/Users/jhareinger/Library/Developer/Xcode/DerivedData/Project-dnx-acpbwukpxzmsfjariuwhmruhhanl/Build/Products/Release-iphonesimulator/Project-dnx.app/Info.plist'

or, I use my existing Legacy Build System and get: error: the use of xcframeworks is not supported in the legacy build system.

jhareinger11 commented 3 years ago

The 2nd option of carthage.sh (which i've used before) has the following error:

Fetching omise-ios Checking out omise-ios at "v3.8.0" xcodebuild output can be found in /var/folders/yf/ntpxp9sx213bn11wxv0vzj5r0000gn/T/carthage-xcodebuild.D8rnUZ.log Building scheme "OmiseSDK" in OmiseSDK.xcodeproj Build Failed Task failed with exit code 1: /usr/bin/xcrun lipo -create /Users/jhareinger/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/omise-ios/v3.8.0/Build/Intermediates.noindex/ArchiveIntermediates/OmiseSDK/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OmiseSDK.framework/OmiseSDK /Users/jhareinger/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/omise-ios/v3.8.0/Build/Products/Release-iphonesimulator/OmiseSDK.framework/OmiseSDK -output /Users/jhareinger/Documents/Project-dnx/Carthage/Build/iOS/OmiseSDK.framework/OmiseSDK

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/yf/ntpxp9sx213bn11wxv0vzj5r0000gn/T/carthage-xcodebuild.D8rnUZ.log

jhareinger11 commented 3 years ago

As for the above code, i have tried the exact copy of the above, but i changed it 1200 to 1220 to account for XCode 12.2 rather than 12.0

As for the build from the script, i manually added to xcode using the standard process. Then I got a Apple Mach-O Linker Error: ld: warning: ignoring file Carthage/Build/iOS/OmiseSDK.framework/OmiseSDK, missing required architecture x86_64 in file Carthage/Build/iOS/OmiseSDK.framework/OmiseSDK (2 slices)

igroomgrim commented 3 years ago

Creating the xcframework would be great, but it comes with other issues that fail:

Either I used New Build Settings and include the xcframework, then get the following message: Multiple commands produce '/Users/jhareinger/Library/Developer/Xcode/DerivedData/Project-dnx-acpbwukpxzmsfjariuwhmruhhanl/Build/Products/Release-iphonesimulator/Project-dnx.app/Info.plist':

  1. Target 'Project-dnx' (project 'Project-dnx') has copy command from '/Users/jhareinger/Downloads/Project-dnx/Project-dnx/Info.plist' to '/Users/jhareinger/Library/Developer/Xcode/DerivedData/Project-dnx-acpbwukpxzmsfjariuwhmruhhanl/Build/Products/Release-iphonesimulator/Project-dnx.app/Info.plist'
  2. Target 'Project' (project 'Project-dnx') has process command with output '/Users/jhareinger/Library/Developer/Xcode/DerivedData/Project-dnx-acpbwukpxzmsfjariuwhmruhhanl/Build/Products/Release-iphonesimulator/Project-dnx.app/Info.plist'

or, I use my existing Legacy Build System and get: error: the use of xcframeworks is not supported in the legacy build system.

In solution 1. For creating "xcframework" solution you don't get any error when creating OmiseSDK.xcframework right? It should create separately from your project. You should put OmiseSDK that you download into another folder. Seems these errors above that occur from 'Project-dnx' target. Could you check it again.

In solution 2. Do you try with ./carthage.sh update --platform iOS?. In this case, you have to use update in the command instead of build.

If 1 and 2 still don't work. Can you try solution 3 for a workaround? You can create a tokenizer method for creating HTTP request and call directly to Omise Token API by Omise PublicKey. In this case, you will receive a Token and then you can pass the TokenID to your server for creating a charge.

😃

thocosals2233 commented 3 years ago

I've tried #1 and #2, but it still cannot build. I receive the following message: "Could not find module 'OmiseSDK' for target 'x86_64-apple-ios-simulator'; found: arm64, armv7-apple-ios, arm64-apple-ios, arm, armv7"

As for #3, this would be simply removing Omise SDK altogether, which isn't really a solution.

Could you please find a solution to the error message resulting from #1/2. Also, could the Omise team to find an to please support CocoaPods? Carthage is only going to have more issues from here on

igroomgrim commented 3 years ago

@thocosals2233 Many thanks. We still find a way to solve this problem. Because for solutions 1 and 2 we tested on 3 machines (1 iMac, 1 Macbook Pro, 1 Macbook Air) with

that why we give solution 3. And for now, our SDK still doesn't support Swift Package Manager and CocoaPods. If we find a new solution, we will let you know as soon as possible. 🙇

wiosm commented 3 years ago

I tried all ways but only one way resolve my problem that I must build manual by using lipo. I already pushed to pods: pod 'Omise', '4.0.1'

tobias90 commented 3 years ago

This issues should be fixed with the latest version of Carthage. Please follow the instructions in the official documentation for Carthage.

We now also support Swift Package Manager with version v4.3.0.