Reputation: 11587
I have a framework which is not available in simulator, So not able to run in simulator. Im getting below error.
Could not find module 'Framework' for target 'x86_64-apple-ios-simulator'; found: arm64, armv7-apple-ios, arm64-apple-ios, arm, armv7
How can i create a dummy framework or is there any way to make it run on simulator. Just like simulator is handling camera like functionalities.
Tried below code: But how to define the else condition.
#if (arch(x86_64)) && os(iOS)
import Framework
#else
#endif
Upvotes: 1
Views: 1147
Reputation: 847
Xcode has different build system for simulator and real devices. So it will generate different app for both. If you select any Simulator target then it will builds app for simulator and if you select Generic iOS Device or any real device target then it will builds different build.
You are using that framework which are builded for simulator target, So follow this steps,
If you don't want to add whole code of framework in your project then you can add particular( for device or simulator ) build of framework in your xcode project. For that follow this steps,
.framework
file from Products folder.I hope this will work for you.
Upvotes: 0
Reputation: 634
You might create a second target without the framework. I do not know how many files use this framework?
If there are not many you can create a duplicated file only available to the second target. Of course, you have to remove any code referencing to this framework in the duplicated file.
This approach should work.
Upvotes: 1
Reputation: 1460
I work for a team that has developed a framework that does not work in simulator (uses camera) but includes the simulator architecture so a developer can use it regardless the device. We only have two entry points and in each of them we put the following code:
#if TARGET_IPHONE_SIMULATOR
return nil;
#else
// code goes here
#endif
I know that this is not ideal and we just return nil
(simulator is the only possibility of returning nil
), but at least you can call it and if nil
do something else instead of crashing or just not compiling at all.
Upvotes: 2