Xcode linking error with realm - ios

I am receiving this linking error in Xcode for the Realm Framework files. I have searched and found users with similar errors with other frameworks. However, I have tried to apply the solutions but nothing seems to work. I haven't found any solutions for a recent version of Xcode.
The this only occurs when building for my device. Everything works in the iOS Simulator.
ld: warning: ignoring file /Users/Developer/Swift/App/RealmSwift.framework/RealmSwift, missing required architecture armv7 in file /Users/Developer/Swift/RealmSwift.framework/RealmSwift (2 slices)
ld: warning: ignoring file /Users/Developer/Swift/Realm.framework/Realm, missing required architecture armv7 in file /Users/Developer/Swift/Realm.framework/Realm (2 slices)
Undefined symbols for architecture armv7:
I am using:
Xcode 6.3.2 Swift
Realm Swift 0.93.1

I removed all of the frameworks then dragged them back in to the project. I had to create an empty Frameworks folder below RealmSwift.Framework/Headers (Not in the installation instructions on the Realm site). Everything is now compiling on my device.

Related

Linker error on the new xcode (ios 8.2 simulator) in cocos2d-x

I've recently updated xcode to the last version. So now my simulator have 8.2 ios version. My cocos2d-x projects are still working on devices (tested on ipad2 and iphone5s), but I can't compile them for simulator. I'm getting huge number of linker errors:
Undefined symbols for architecture x86_64:
"_AVAudioSessionCategoryAmbient", referenced from:
-[CDAudioManager setMode:] in libcocos2d iOS.a(CDAudioManager.o)
-[CDAudioManager applicationWillResignActive] in libcocos2d iOS.a(CDAudioManager.o)
...
few hundred lines more
...
ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed
with exit code 1 (use -v to see invocation)
Showing first 200 notices
only Showing first 200 errors only
Generally there are errors of all frameworks I use as well as cocos2d-x library itself. Before getting there most frameworks was highlighted red, but I fixed that making a symlink to:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
using this:
sudo ln -s iPhoneOS.sdk iPhoneOS8.1.sdk
I'm of course using cocos2d-x 3.4.
edit:
After migrating to v. 3.5, setting valid architectures to: armv7, armv7s, i386, x86_64, setting build active architecture only to no (in both main and cocos2d_libs project) with various settings variations now I'm getting:
Undefined symbols for architecture i386:
And other's the same. Doesn't work on any simulator. I even downloaded 8.1 simulators and it doesn't work there too. This is some stupid linker error and I can't figure it out.
I've also noticed that fresh project builds fine. In my project I also have few objC classes (for other stuff like admob), which are using ARC. So I had to add "-fobjc-arc" in few places in build phases->compile sources. Problem is it's only simulator-related problem and appeared when I've updated ios sdk from 8.1 to 8.2.
Regards

Xcode 6 Error - "Missing Required Architecture i386" When Building for iOS Simulator

I have created a custom Objective-C framework. I would like to import it into any given iOS project and use its provided functionality on both the iOS Simulator and an actual device. To import the framework, I link it using the Build Phases > Link Binary With Libraries setting in the app's target. I'm then able to import it into one of my classes with this statement:
#import <CustomFramework/CustomFramework.h>
I can instantiate my framework's classes just fine, but when I try to run my project on a device, I get the following error message:
dyld: Library not loaded: #rpath/CustomFramework.framework/CustomFramework
Referenced from: /var/mobile/Applications/A61E882D-481A-4C0B-B4FD-69F5D24968BF/TestApp.app/TestApp
Reason: image not found
And if I try to run it on the simulator, I get a different error message:
ld: warning: ignoring file /Users/user/Desktop/CustomFramework.framework/CustomFramework, missing required architecture i386 in file /Users/user/Desktop/CustomFramework.framework/CustomFramework (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CustomFramework", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This occurs when I instantiate a class from the framework. If I import the framework but don't actually use it, my app builds successfully. It just errors whenever I instantiate a class from the framework for some reason.
To get the app to build on a device, I followed this SO answer. Instead of linking the framework, I added a new Copy Files phase in the target's Build Phases setting, set the Destination to Framework, and added my framework.
That works great; however, I'd like to test my app on the iOS Simulator as well. When I try to run my app on the simulator, I still get the "missing required architecture i386" error. I've tried the solutions proposed at just about every related SO topic I could find, and nothing has helped me resolve this issue.
Please note that I am trying to use my custom framework in a new Xcode project, so none of the app/build settings have been changed from their defaults.
How can I fix this error so that I can run my app on both the iOS Simulator and a device with my framework included in the project? Any insight would be greatly appreciated!
The issue was that the framework was not compiled for the iOS Simulator's architecture, which is i386. Xcode only compiles a framework for the target architecture, so if I built the framework for the iOS Simulator, it wouldn't work on a device, and if I built the framework for a device, it wouldn't work on the iOS Simulator.
I created my framework from scratch with help from this tutorial: http://www.raywenderlich.com/65964/create-a-framework-for-ios
The multi-architecture build script is what allowed my framework to run on both the iOS Simulator and a device.
I encountered this same problem with Xcode 7.1 when trying to build for the simulator.
Someone else said it worked for them under Xcode 8.2.1, so I tried building/running there and it worked. I didn't have to change targets or anything in my project.
So try upgrading your Xcode if you can, you will presumably get additional bug fixes as well.

Supress `missing required architecture i386` warning for Optional Frameworks?

I have some Framework linked as OPTIONAL (using camera), so it won't compile for Simulator, which is great. The app builds, runs fine on Simulator.
Is there any way to supress missing required architecture i386 warning when build for Simulator?
Full warning:
ld: warning: ignoring file <WhateverFramework>, missing required architecture i386 in file <WhateverFramework> (2 slices)
An "Optional" framework is optional at runtime only. It is required to be present at build time.
You can use platform-specific build settings to avoid linking to that framework at all in simulator builds.

What exactly is crt1.3.1.o

I'm using xcode 4.5 My Base SDK is 6.0 and my deployment target is 5.1. When I try to build for release or profiling I get this little gem of an error.
ld: file is universal (4 slices) but does not contain a(n) armv7s slice: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/crt1.3.1.o for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Now....
I have seen this message posted on stackoverflow but Im still none the wiser.
What exactly is this crt1.2.1.o thats causing all the fuss?
Can I modify it somehow to kill my error?
And finally it has been suggested that I simply set build for active architectures only. What are the implications of doing this?
Thanks
The crt1.3.1.o file contains the startup code for the C runtime library. This initializes the runtime, calls global initializers and finally calls the main function.
Something must be amiss with your project settings. You are compiling for armv7s as well, but the libraries are being linked from the iOS 5.1 SDK which doesn't support the armv7s architecture yet.
I had this same issue, I removed armv7s from valid architectures in build settings and left only armv7, after that I could archive my project

Google Conversion Tracking for iOS linker error for architecture armv7

I'm trying to add the Google Conversion Tracking for iOS feature to my iPhone app.
The app's base SDK is iOS6
the app's valid architectures is armv7, armv7s
the app's iOS deployment targer is 4.3
I'm using the latest xcode 4.5.2 and OSX 10.8.2
The app is in appstore and is ok for iPhone 3-4-5
When I try to add the Google Conversion Tracking for iOS following this link: https://developers.google.com/mobile-ads-sdk/docs/admob/conversion-tracking
I have this error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleConversionTracking.a(PingUtil.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The SDK library references the iOS AdSupport development framework
which may not already be part of your project. It can be resolved by
including AdSupport.Framework.
To adding the Framework, just follow the steps below. Select the
project file at the top. Open the Link Binary With Libraries drop-down
under the Build Phases tab. Add the framework from the iOS SDK using
the + button.

Resources