Using `-weak_framework` but still cannot compile - ios

I'm using -weak_framework CoreAudioKit and my project still cannot compile for the iOS Simulator.
Error is ld: framework not found CoreAudioKit
If I compile for the actual iOS device, compilation goes fine
When I remove this line (well, two lines) from Other Linker Flags the project compiles.
How can I compile on the Simulator and still get the framework on an actual device?
Note: in code I'm using this #if !TARGET_IPHONE_SIMULATOR, which works but solves a separate problem.

From what I can tell, that's not what weak_framework does, and it's not applicable to this context. It says in the docs, "CoreAudioKit framework is not available when using the iOS Simulator. The project with fail at build time." If weak linking allowed you to compile with a missing framework, they would have mentioned it.
You can, however, have another build target for just the Simulator.

Related

SceneKit broken in Xcode 6 beta 3

Since updating to beta 3 anything that makes use of SceneKit throws 200 build errors when a device is targeted (works find in simulator). Even the sample SceneKit project fails to build now.
Is anyone else experiencing this issue and has anyone found a solution? I have tried deleting derived data, reinstalling, etc
<unknown>:0: error: /Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitTypes.h:8: could not build module 'simd'
<unknown>:0: error: could not build Objective-C module 'SceneKit'
Full build error log: http://pastebin.com/PQwCBLrg
There is a bug in Xcode beta 3 and SceneKit project don't compile on armv7(s) devices. However it works for arm64 devices (just be sure to enable "build active architecture only" in the Build settings so Xcode does not try to compile for armv7).
This also only occurs when using Swift. Objective-C projects with SceneKit still compile fine for older devices.

Making Xcode ignore static library when building for iOS Simulator

I have a Xcode project, that includes a Static Library project, that uses another static library that does not support the iOS simulator architecture (Vuforia SDK: libQCAR.a).
Vuforia SDK documentation states:
Vuforia applications must be deployed to a device to run; they cannot be run in the iOS simulator.
This is my project structure:
MyApp.xcodeproj
Classes
MyStaticLibrary.xcodeproj
Classes that depends on libQCAR.a
Frameworks
libMyStaticLibrary.a
libQCAR.a
My problem is that MyApp.xcodeproj does not build for the iOS Simulator because libQCAR.a is not built for the i386 architecture.
Is there anyway to make MyApp.xcodeproj ignore the libQCAR.a library when building for i386? I would be able to disable all the code that depends on the library with #if !(TARGET_IPHONE_SIMULATOR)
You can use a conditional build settings to specify the library you want to link only on a given platform, instead of adding the library to your project in the usual ways. Specifically, you will need to specify:
-lQCAR
in "Other Linker Flags".
Have a look at the attached image that should make things more clear (in the picture I am linking only for the simulator, you will want to select a device, I guess).
Also, do not forget to add the path to the directory containing the library to "Library Search Path" build setting (this does not need to be conditional; it would not do any harm on the simulator).
This issue seems very similar to: Xcode: Conditional Build Settings based on architecture (Device (ARM) vs Simulator (i386))
I believe sergio's solution is very close, but have you tried specifying the full path to the library under Other Linker Flags (potentially without "-l" - just the path)?
In my case, it should specify clearly which SDK uses which flags.
So in Any iOS Simulator SDK, you should not include the library.
In Any iOS SDK, you should include it. In my case, it's -lCloudReco.

Missing required architecture arm64 in Xcode

I'm getting the error "missing required architecture arm64 in file /user/location/myframework.a(2 slices)" when I compile my project to the iPad mini, it refers to a specific third party framework that I'm using. This error does not show up for any of the older arm7 devices.
I know that this framework should be compiled to support the arm64 framework so to debug I created a second project that was completely blank except for this framework and it compiles just fine for the iPad mini. I used some of the functionality of the framework just to be sure it was actually being used by the project and it worked just fine.
So I'm 100% sure the issue isn't with the framework but with my project settings or something. I figured it might be that the old framework was still being cached somewhere so I cleaned and rebuilt, I deleted derived data, I removed the framework completely rebuilt and then added it back in. Nothing made a difference, it still comes up with the error "missing required architecture arm64 in file /user/location/myframework.a(2 slices)"
What might possibly be causing this problem?
EDIT:
I should have mentioned that the project installs fine on the iPad mini when the above framework is not included in the project. arm64 is listed as a valid architecture in the project settings.
if not include 64 bit please include 64 bit
According to lipo -info, the included SDK only has i386 and x86_64 architectures.

Making calls to a static library crashes my iOS simulator

Since making the transition to XCode 4.5 and building with iOS 6 SDK my app crashes every time I make a call to a third party framework or static library .a file. Initially when I made the transition to XCode 4.5 these frameworks worked. The issue started popping up as I began updating the frameworks. After deleting the old version of the framework and adding the new one I would begin getting the crash on my simulator.
Running the code on the device works fine as expected but as soon as I make a call to any one of my third party frameworks or static libs on the simulator I'm doomed. Some of the frameworks that cause a crash are the Parse Framework, Socialize. The errors
Has anybody experienced this or hopefully found a solution? Testing on the device is slower but the real bummer is that I can't run any unit tests on my app.
Thanks,
Since you said you updated the frameworks or static libraries:
Are you sure that the APIs of these frameworks/libraries did not change in the meantime?
Are you sure you added the frameworks in the "Link Binary With Libraries" again in your Build Phases of your application project, to link your app with the fmk/libs?
Also be sure that the -ObjC flag is still present in your application's "Other Linker Flags" build settings, even if there is no reason not to if you had it already (as it worked before).
Besides, what is the crash log and error message when you call these methods?

iOS Development: problematic framework search path

I have an iOS app and I want to test it on simulator. When I run the project xcode complains that my framework file is "missing required architecture i386 in file".
I did a bit of search on line and it says that's because xcode used the framework files intended for actual device when building the project for simulator. Solution is to add the simulator framework folder under the framework search path in build settings.
Okay now the problem is, doing that solves the problem of building project on simulator, but later when I want to build the project on an actual device, xcode starts complaining again saying there are redefinitions of some of the openGL typedef in the framework. To fix this I have to remove the search path item that I added.
So is there an easy way to avoid having this kind of problem? I don't want to switch the search path over and over again when I want to build the project on different platform.
If you upgrade a project from 4.2 to 4.3.2 style it often loses the architectures required for the target you are building for. Usually you just have to add them back or change the target SDK.

Resources