MapKit not working on device but works in simulator - iphone

I have added the frameworks (MapKit and CoreLocation) by selecting the Frameworks folder, right clicking, Add > Existing Frameworks.
The app builds in the Simulator (3.1.3) but fails on the Device (3.1.3) with the error:
ld: warning: in
/Development/Sites/iPhone
Projects/SwitchViews/MapKit.framework/MapKit,
file is not of required architecture
Undefined symbols:
"_OBJC_CLASS_$_MKPinAnnotationView",
referenced from:
__objc_classrefs__DATA#0 in NextView.o ld: symbol(s) not found
collect2: ld returned 1 exit status

It seems that I just needed to restart Xcode to get things linked up properly.

It looks like you by accident have selected the "copy to project" checkbox when adding the framework.
Try to delete the framework from your project and add it again, making sure you have selected the default framework path, and that you don't copy it to your project.

Related

Xcode Error - Undefined symbols for architecture x86_64?

I'm running Swift 4 and Xcode 9 beta. I get this errors and I have no idea how to solve it. I don't even know what does that mean..
Undefined symbols for architecture x86_64:
"__T0So22AVCapturePhotoSettingsC12AVFoundation01_abC16SwiftNativeTypesACWP", referenced from:
__T014InstagramClone26CustomCameraViewControllerC23cameraBtn_TouchUpInsideyypF in CustomCameraViewController.o
"__T012AVFoundation39_AVCapturePhotoSettingsSwiftNativeTypesPAAE016availablePreviewc11PixelFormatG0Says6UInt32VGfg", referenced from:
__T014InstagramClone26CustomCameraViewControllerC23cameraBtn_TouchUpInsideyypF in CustomCameraViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea how to solve this?
On my case, I've called settings = AVCapturePhotoSettings() and I got that error.
Eventually the solution was calling a different initialiser. i.e:
settings = AVCapturePhotoSettings(format: [AVVideoCodecKey : AVVideoCodecType.jpeg])
It looks like your project probably isn't linking against AVFoundation. Click on your project at the top of the Project Navigator, select your target, and click "Build Phases." In the "Link Binary with Libraries" phase, click the Add button, select AVFoundation from the list, and add it. This should cause your project to build normally.

ignoring file [path] missing required architecture i386 in file

I'm quite new to Xcode and Iphone development and ran into the following problem:
I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor).
I get the following warning:
ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)
If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:
ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.
More info:
I'm Using Xcode 4.6.1
The files are currently located at project's root folder.
I'm using a Single View Application tamplate.
Appreciate any help
This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).
You can use this terminal command to create a universal library:
lipo -create lib_arm.a lib_i386.a -output lib_universal.a
More info about lipo command here.
Change your target's "Build Settings > Build Active Architectures Only" to "No"
This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.
If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.

error:""_OBJC_METACLASS_$_CDVViewController", referenced from:" in Xcode4.3

I am new to iphone develop and phonegap also. Now i want to create simple iphone app using phonegap. Now i am using phonegap2.0 in lion mac. MY Xcode version is 4.3. Now my issue is after install the phonegap2.0 in xcode when i run the Xcode in my Simulator 5.0. I got this below error.
"Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CDVViewController", referenced from:
_OBJC_CLASS_$_ViewController in ViewController.o
objc-class-ref in AppDelegate.o
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_ViewController in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
Please help me to solve this issue. Thanks in Advance.
And i have attach the Screen Shot of error page for your reference.
Check if your project links libCordova.a (in my case Xcode forgot about the reference, when moving CordovaLib.xcodeproj to another location).
select your project in the Project Navigator
go to the Summary tab
drag CordovaLib.xcodeproj > Products > libCordova.a to Linked Frameworks and Libraries
Clean & build.
Please check your ViewController.m file and goto to
1. Build phase in xcode
2. Select Compile Sources
3. Press + button to add .m/.mm file
I think it will run successfully now
Remove armv7s from your build settings, for both your project and the referenced subproject Cordova. Set your target to 4.3.
I had a similar issue. Somehow my the NSManagedObject Sub-classes of my Core Data entities were in the Compile Sources table twice. The compiler would choke when it hit the first of these duplicates.
I just went into the Compile Sources table and deleted the second occurrence of each .m listing.

Google plus SDK emits linker errors when trying to integrate with iPhone App

Some simple things sometimes just don't work ;) like this one! Am trying to integrate Google+ SDK into an iPhone App by following the instructions given here:
https://developers.google.com/+/mobile/ios/#initialize_the_google_client
I did every single step. But when I build the App, it complains of the following errors:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GTMOAuth2Keychain", referenced from:
objc-class-ref in libGooglePlusUniversal.a(GooglePlusSignIn.o)
"_OBJC_CLASS_$_GTMOAuth2SignIn", referenced from:
objc-class-ref in libGooglePlusUniversal.a(GooglePlusSignIn.o)
"_OBJC_CLASS_$_GTMOAuth2ViewControllerTouch", referenced from:
objc-class-ref in libGooglePlusUniversal.a(GooglePlusSignIn.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The classes it's reporting of, are part of the Open Source Google Toolbox project (which is also present in the downloaded SDK, but the instructions ask the user to include only GooglePlusShare.h and libGooglePlusUniversal.a in the project in XCode). I tried including the header files from the directory 'google-plus-ios-sdk-1.0.0\OpenSource', but that's of no use. I tried including the entire (not just .h files) from the directory 'google-plus-ios-sdk-1.0.0\OpenSource' & it leads to lot of ARC related errors (more than 500 of them!); so I quit this option.
Any help on how to resolve these linker errors please?
My environment: XCode 4.3.3, iOS 5.0, Mac OS X Lion 10.7.4, testing with iPhone 4
Just select GData.xcodeproj .
select GDataTouchStaticLib from target .
search "othet c flag"
remove "-DGTM_INCLUDE_OAUTH2=1" if exist
add "-DGDATA_INCLUDE_OAUTH2=1"
click on done. clean project and then build.
Missing keychain and auth-stuff usually means you never imported the Security.framework in your project.
Check another time if you really did include the libraries
Security.framework
SystemConfiguration.framework
in your Xcode project as described in step 1 of the instructions you referred to.
To verify this:
Click on your project name in xcode and select your target.
Under the tab "Build Phases" these two frameworks should be listed under the secition called "Link Binary With Libraries".
If not listed, press the + button to add them.

iphone .objc_class_name error

I've been fighting this framework error for days now. I have included the MessageUI framework from the iphone3.0sdk and imported the header file(MessageUI/MessageUI.h)
Anyone know what this error means?
collect2: ld returned 1 exit status
symbol(s) not found
literal-pointer#_OBJC#__cls_refs#MFMailComposeViewController
".objc_class_name_MFMailComposeViewController", referenced from:
Here is some output from the build log:
ld warning: in /Users/me/iphone/myApp/MessageUI.framework/MessageUI, missing required architecture i386 in file
Undefined symbols:
".objc_class_name_MFMailComposeViewController", referenced from:
literal-pointer#__OBJC#__cls_refs#MFMailComposeViewController in myViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
You forgot to link to the MessageUI.framework or you're linking to the wrong version.
Here's the right way to add frameworks:
Double-click your target
Select the main tab
Add the framework by pressing the plus-button in the frameworks section
Now you should be able to build for the simulator and the device.
Edit:
The warning from ld looks like you copied the MessageUI.framework from the simulator SDK to your project directory. Delete it and ld should find the right one (the one in your current SDK).
You accidentally copied the iPhone SDK Framework into your project directory (on disk). Open your project directory (where you keep the project on disk) and delete the iPhone SDK Framework directory.
Rebuild.