Reference/Linker errors in Archiving App Xcode - objective-c

I'm trying to archive my app in Xcode, and had a bunch of problems. After fixing the major ones, I'm having another couple errors. This one, I'm very much confused. I'm using the NMSSSH library in my app, and it works perfectly fine on iOS devices, as well as the simulator. However, when I try and archive it, I get the error saying:
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_NMSSHSession", referenced from:
objc-class-ref in UserPi.o
ld: symbol(s) not found for architecture armv7s
Any ideas on what the issue could be? These are the #imports of the file it's talking about.
#import <Foundation/Foundation.h>
#import <NMSSH/NMSSH.h>
#import "ConnectionViewController.h"

My guess is that there is a mismatch in build architectures:
Your project is being built for the armv7s architecture
But the NMSSSH library has not been build for armv7s
You need to make sure that the library and your project use the same architecture settings, so either 1) remove armv7s from your project, or 2) add armv7s to the NMSSSH library build. Solution 2 of course only works if you are building NMSSSH yourself from source.
To change the architecture of a project
In Xcode in the Project navigator (left-hand side of the Xcode window), select your project
In the Standard editor (middle section of the Xcode window), select your project
Select the "Build settings" tab
You should now see a section titled "Architectures", and a build setting labelled "Architectures". The build setting is what you need to change.
To find out more about this issue try to google for "Undefined symbols for architecture armv7s" (have you tried that before?). There are also lots of questions on Stack Overflow on this issue, e.g. this one. Good luck.

Related

ObjC Category doesn't link to iOS7

I'm using SDWebImage with CocoaPods, and the app I'm working on must support iOS7.
After installing SDWebImage version 4.0.0 with CocoaPods, I import it into a class with #import <SDWebImage/UIImageView+WebCache.h>.
I use one of the category's methods, sd_setImageWithURL:, to asynchronously download an image.
This works fine on iOS8-10. But for some reason (only on iOS7), the app crashes saying that the sd_setImageWithURL: is an unrecognized selector.
Why would the category not load properly on only one OS? This doesn't make any sense to me at all. :/
Update:
I ran an analysis on the project, and I noticed this warning:
ld: warning: ignoring file <path/to/file>/libSDWebImage.a, file was built for archive which is not the architecture being linked (armv7): <path/to/file>/libSDWebImage.a
(The path was really long. I replaced it with <path/to/file>)
As I suspected, this warning does not show up when running on newer versions of iOS, which also use a different architecture, arm64.
So, it looks like the library libSDWebImage.a is being build for arm64. What can I do about this?
I set Build Active Architecture Only to NO in Build Settings, then did the "deep clean" as suggested by the answer here: Undefined symbols for architecture armv7: cocoaPods iPhone 5
That seemed to solve the issue for me.

card.io will not compile on 64bit iPhone 5s armv7s

I'm having trouble compiling card.io on an iPhone 5s in 64bit mode (armv7s). It will compile on the simulator just finw. I am using Xcode 5.
Here is my error message:
Undefined symbols for architecture armv7s:
"_CMSampleBufferGetImageBuffer", referenced from:
-[CardIOVideoFrame process] in libCardIO.a(CardIOVideoFrame.o)
"_CMGetAttachment", referenced from:
-[CardIOVideoStream captureOutput:didOutputSampleBuffer:fromConnection:] in libCardIO.a(CardIOVideoStream.o)
ld: symbol(s) not found for architecture armv7s
Although, as #tomwhipple implied, you'll eventually run into other problems if you try to incorporate the current version of card.io into a 64-bit app, the particular error message you're getting now is due to something else.
Specifically, you must include the CoreMedia framework in your app's project.
See https://github.com/card-io/card.io-iOS-SDK for a complete list of the frameworks that you need to include.
A 64 bit version of card.io is under development, but not yet released. We'll update this Github issue when it's ready.

Facebook iOS SDK 3.1 with XCode 4.2 linker errors

I've just updated the Facebook iOS SDK in my project from 3.0 to 3.1. The project does not compile anymore. Instead I get the following linker errors:
Undefined symbols for architecture i386:
"_ACFacebookAppIdKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceEveryone", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceFriends", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceOnlyMe", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookPermissionsKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in FacebookSDK(FBSettings.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The Facebook docs clearly say:
The SDK relies on three other frameworks (AdSupport, Accounts and
Social) to use the Facebook features built into iOS6.
Those frameworks do not exist in Xcode 4.2 . Is there any workaround, i.e. can I download (where?) and add the frameworks manually to my project and will that suffice to get rid of the compile errors or do I have to upgrade to Xcode 4.5?
Those frameworks are part of iOS 6 (well, except for Accounts, which is from iOS 5). You won't be able to use them without upgrading to Xcode 4.5, and consequently, iOS 6 SDK.
You can still set your deployment target down to iOS 4.3, if that's your concern.
I think your options are:
Upgrade to Xcode 4.5, or
Use Facebook SDK 3.0.
To make things clear:
For XCode 4.5:
If you use FB SDK3.0, you only need to add Accounts and FacebookSDK frameworks.
If you use FB SDK3.1, you need to add Accounts, FacebookSDK, Social, and AdSupport frameworks.
If you use FB SDK3.2++, check by yourself what other frameworks you may or may not need. ;)
Hope that sums it up nicely for everyone.
The SDK relies on three other frameworks (AdSupport, Accounts and Social).
To add these, go to the 'Linked Frameworks and Libraries' section of the target's Summary pane, and add them.
Sobri is right. Either upgrade to Xcode 4.5 or use SDK 3.0 or If you want to use 3.1 then download the source from github, modify the build file(basically remove the references to frameworks provided by iOS 6.0 ) and rebuild the SDK. That ways you can use the SDK 3.1 as well as run it on older XCode versions.
The following steps may be helpful to resolve this issue
Download Facebook iOS SDK 3.0 from links present in the URL http://developers.facebook.com/ios/features/whats-new-ios-sdk-3/
Add the FacebookSDK framework from Mac Documents directory
Add sqlite3 to project
Then, I've tried the code in http://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/ with the following changes (as it is for Facebook iOS SDK 3.1)
Replace openActiveSessionWithReadPermissions with openActiveSessionWithPermissions
Replace [FBSession.activeSession handleDidBecomeActive]; with [FBSession activeSession];
This worked for me. Try it once.
Thanks,
prodeveloper.

clang error is coming on runtime

I am working on app and suddenly prefix.pch file deleted automatically and
this error comes:Command /Volumes/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
i havn't found any working answer in google search.
Please help me out
It looks like the problem had to do with the Architecture settings on my sub projects. Xcode 4.2 changes the default Architecture to just armv7 instead of both armv6 and armv7. I had updated my main project to armv6 and armv7, but the sub-projects were still only using armv7. Once I updated all of the sub-projects then it started linking properly.

Trying to hack the AWS IOS SDK so that it works for OSX. I get this error

I've removed the import of the UIKit framework, and now I get this error. Do I have to somehow recompile the framework? It's not really giving me anything to go on...
And if it means anything, I am able to run the SDK examples in IOS so there aren't any system requirements that I'm not meeting.
ld: warning: ignoring file /Developer/SDKs/MacOSX10.7.sdk/Library/Frameworks//AWSiOSSDK.framework/AWSiOSSDK, missing required architecture x86_64 in file
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AmazonS3Client", referenced from:
objc-class-ref in Constants.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You can't just use the .framework provided by Amazon, because the binary is only for iOS. You need to rebuild the framework from the source, which thankfully comes in the SDK.
I created a XCode project with the source from the iOS SDK that appears to work. I have only tested some of the rudimentary S3 code but since it works in iOS, presumably, and I am able to communicate with S3, I think it should be good for all the services it supports.
https://bitbucket.org/danap/osx-aws-toolkit
Please feel free to fork and submit pull requests with changes.
I've created a fork of the AWS iOS SDK which can be built and used for Mac OS X development. Check it out: https://github.com/amberdixon/aws-sdk-ios. In the readme, I've included instructions on how to build the Mac OS X-compatible version of the AWS iOS SDK framework, which you can import into your OS X projects.