Closed fnuky closed 1 year ago
Hi, please how to run sample app on ios simulator on arm mac? Some of pod dependencies are not supported on arm simulator
i run ios simulator success,What is the detail of your error?
Hi,
I’m trying to integrate tuya SDK to your home security app. We have also catalyst support but this I fixed. Problem at me is with iOS simulator on arm64 CPU (M1,M2,….)
When I add security FW and install PODs
error is shown:
[!] CocoaPods could not find compatible versions for pod "SGQRCode": In Podfile: SGQRCode (~> 4.1.0)
None of your spec sources contain a spec satisfying the dependency: SGQRCode (~> 4.1.0)
.
When I remove specific version, problem is with buikd Scan code SDK because version is resolved for
Installing SGQRCode (3.5.1)
So it is not compatible, SDKs has excluded ARCH for arm64 simulator, my simple question is why? :) You have already done transition to XCFrameworks. SDK is building for x64. Problem is when you have project based on workspace and separated projects, top level project is linking arm64 arch but pods has builded only x86_64 simulator arch and it could not be combined. I can try to manually exclude arch arm64 for simulator in my project if it will work but better solution is add arm64 architecture to all tuya sdk submodules (there is already in more than half of modules)
Jakub Mejtský
26. 4. 2023 v 4:54, taojingGino @.***>:
Hi, please how to run sample app on ios simulator on arm mac? Some of pod dependencies are not supported on arm simulator
i run ios simulator success,What is the detail of your error?
— Reply to this email directly, view it on GitHub https://github.com/tuya/tuya-home-ios-sdk-sample-objc/issues/10#issuecomment-1522695816, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYVRU3QIT6PRFB5WEKSSMTXDCFADANCNFSM6AAAAAAXJ4RUNY. You are receiving this because you authored the thread.
So it is not working, we have SPM dependencies and there is not possible to exclude arch arm64. then Tuya SDK is not possible to build, transfer to cocoapods whole project is not possible
Ok, I deleted code based on SGQRCode..
Demo project by default is building, but it is stopped when you just add any SPM dependency to project and import it in Swift file added to project.
And it is not problem of SPM dependency, it is problem that tuya sdk has excluded arm64 simulator arch and SPM cannot handle it when building for ARM arch for simulator
Ok, I deleted code based on SGQRCode..
Demo project by default is building, but it is stopped when you just add any SPM dependency to project and import it in Swift file added to project.
And it is not problem of SPM dependency, it is problem that tuya sdk has excluded arm64 simulator arch and SPM cannot handle it when building for ARM arch for simulator
it looks like alamofire is not properly installed or added to the project. If you have manually installed Alamofire, make sure you have added the correct framework search paths in the "Build Settings" tab. Check the framework search path settings in the "Build Settings" tab and make sure they are correctly pointing to Alamofire.
No, it is not problem of Alamofire. It is problem of Tuya sdk and excluded archs. Swift package manager cannot handle excluded architectures such as arm64 simulator and trying to build and then cannot link together. Maybe it is problem of Xcode but it cannot be solved. Please try it by yourself by adding any other dependency with SPM. Project stops wotking.. Same problem with Carthage dependencies.. Some dependencies are not support Cocoapods and some developers are not using them.
The error message indicates that the compiler cannot find the corresponding X86_64 architecture binary library when compiling the Swinject module introduced by Swift package manager, because all binary libraries in your project are arm64 architecture.
To solve this problem, you need to specify the architecture of the Swinject module as arm64 in Swift package manager. Specifically, you can create a file named "Package.swift" in the project root directory, and then specify the architecture of the Swinject module in the file. For example:
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "MyProject",
platforms: [
.iOS(.v11)
],
dependencies: [
.package(url: "https://github.com/Swinject/Swinject.git", .upToNextMinor(from: "2.7.1"))
],
targets: [
.target(
name: "MyProject",
dependencies: ["Swinject"],
linkerSettings: [
.unsafeFlags(["-arch", "arm64"])
]
),
.testTarget(
name: "MyProjectTests",
dependencies: ["MyProject"]
)
]
)
In this example, we specify the architecture of the Swinject module as arm64 by adding the -arch arm64
flag in linkerSettings
. This way, when compiling the Swinject module introduced by Swift package manager, the compiler will use the arm64 architecture binary library for linking, avoiding the above error.
Note that if there are other modules introduced by Swift package manager in your project, you also need to specify their architectures as arm64 in the same way.
If you don't want to specify the architecture of the Swinject module in Swift package manager, there is another solution. You can manually add the Swinject module source code to your Xcode project to avoid this issue.
The error message indicates that the compiler cannot find the corresponding X86_64 architecture binary library when compiling the Swinject module introduced by Swift package manager, because all binary libraries in your project are arm64 architecture.
To solve this problem, you need to specify the architecture of the Swinject module as arm64 in Swift package manager. Specifically, you can create a file named "Package.swift" in the project root directory, and then specify the architecture of the Swinject module in the file. For example:
// swift-tools-version:5.3 import PackageDescription let package = Package( name: "MyProject", platforms: [ .iOS(.v11) ], dependencies: [ .package(url: "https://github.com/Swinject/Swinject.git", .upToNextMinor(from: "2.7.1")) ], targets: [ .target( name: "MyProject", dependencies: ["Swinject"], linkerSettings: [ .unsafeFlags(["-arch", "arm64"]) ] ), .testTarget( name: "MyProjectTests", dependencies: ["MyProject"] ) ] )
In this example, we specify the architecture of the Swinject module as arm64 by adding the
-arch arm64
flag inlinkerSettings
. This way, when compiling the Swinject module introduced by Swift package manager, the compiler will use the arm64 architecture binary library for linking, avoiding the above error.Note that if there are other modules introduced by Swift package manager in your project, you also need to specify their architectures as arm64 in the same way.
That will stop building other architectures such as catalyst and others if they are using same dependency and target. If we will talk about Package.swift example which you sent me, it is not working and if you try it, it will not create wanted target to build.
Also this is not solving problem when you add package by Xcode -> Add Package Dependency -> any dependency (SPM in xcode not package)
I find it weird to use "unsafeFlags". It's not unsafe for no reason..
Why you just don't add arch arm64 simulator to all tuya sdk dependencies? It is so hard? This wil solve all problems. It is almost in half dependencies..
Please send me a zip file of the project that reproduces the compilation issue in the screenshot via email.
tuya-home-ios-sdk-sample-objc.zip
Zip with clean pods (to don't have 200MB+ size archive)..
Which Xcode you are using? I'm on 14.2.. I don't se Destination Architectures switch as you can see in screenshot but this is just workaround how to run on intel simulator on arm. Apple plans to end support of rossetta.. You will you fix it when it's too late?
But it is not why I'm doing this. All problems are in CI integration with fastlane when my project has tests which are running in every merge request in company to be sure that any employee did not push anything wrong. This is basic problem, not test app on simulator, I have a lot of testing devices.
Xcode 14.3
Why is issue closed? You are not fully support arm64 simulator architecture. You are offering just workaround. I wanted to show you problem case and also in Xcode 14.3 i don’t see switch for x86_64 arch..
Hi, please how to run sample app on ios simulator on arm mac? Some of pod dependencies are not supported on arm simulator