I pod install NYXImagesKit to my example project, it builds successfully but after the simulator lunches, there is error in Xcode:
/XXX.m:17:9: 'NYXImagesKit.h' file not found
Everything is fine, the simulator works fine, the only problem is that the build error is there but no link error, it is very strange.
I have ${PODS_HEADERS_SEARCH_PATHS} defined in HEADER SEARCH PATH, and the pod.config is as follow:
ALWAYS_SEARCH_USER_PATHS = YES
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS} $(SDKROOT)/usr/include/libxml2
OTHER_LDFLAGS = -ObjC -lxml2 -framework Accelerate -framework AssetsLibrary -framework CoreImage -framework ImageIO -framework MobileCoreServices -framework QuartzCore
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/NYXImagesKit" "${PODS_ROOT}/BuildHeaders/hpple"
PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/NYXImagesKit" "${PODS_ROOT}/Headers/hpple"
PODS_ROOT = ${SRCROOT}/Pods
I'm surprised the simulator launches if it's showing you a build issue. You might want to try cleaning your project from Product -> Clean in the menu bar. Or deleting your derived data from the Organizer. Also verify that CocoaPods has the newest version with pod --version (right now it is 0.21.0) otherwise update with [sudo] gem update
Related
My iOS app is able to run normally on simulators, but when I tried to archive it, I got the following error.
ld: library not found for -lPods-MOEDict-Google-Mobile-Ads-SDK
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is my other linker flags:
-ObjC -l"Pods-MOEDict-Google-Mobile-Ads-SDK" -framework "AVFoundation"
-framework "AudioToolbox" -framework "CoreGraphics" -framework "CoreTelephony" -framework "EventKit" -framework "EventKitUI"
-framework "GoogleMobileAds" -framework "MessageUI" -framework "StoreKit" -framework "SystemConfiguration" -weak_framework "AdSupport" $(inherited)
Solved the problem myself my deleting the entire other linker flags and replaced it with $(inherited)
If you are using cocoapods don't manage the pods manually.
Try running follow commands:
// Removes every trace of cocoapods from the xcode project
pod deintegrate
// Reinstalls and links cocoapods (probably gonna fix the missing framework)
pod install
I'm pretty new to XCode and I tried to link libc++ and libz in XCode, under Build Settings - Other Linker Flags, but when I add a new line that says libc++ or libz, I get an error stating no such file or directory libc++
I also tried by adding libc++.dylib and /usr/lib/libc++.dylib, but still the same error.
Any help would be appreciated.
[EDIT]
I get this in the error message:
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.
platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/
usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
And this:
/-weak_framework CoreFoundation -weak_framework UIKit
/-weak_framework AVFoundation -weak_framework CoreMedia
/-weak-lSystem -ObjC libc++.tbd -fobjc-arc -fobjc-link-runtime
/-framework Fabric -framework AssetsLibrary -framework Crashlytics
/-framework Security
clang: error: no such file or directory: 'libc++.tbd'
Is that being linked correctly?
Finally figured that out by myself, I had to add them using the Link Binary With Libraries option under Build Phases.
https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/AddingaLibrarytoaTarget.html
I am trying to add Google-Maps-iOS-SDK (1.8.1) using cocoapods (0.33.1).
Deployment target version: iOS 7.0
I have added this pod: pod 'Google-Maps-iOS-SDK', '~> 1.8'
Downloaded and installed sdk properly.
I started adding header file and sample map view loading code from here.
I have properly added API keys. In one view controller's - (void)viewDidLoad,
I have added following code:
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
GMSMapView *mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = #"Sydney";
marker.snippet = #"Australia";
marker.map = mapView_;
I got this error on build for iPhone (not in simulator)
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GMSMarker", referenced from:
objc-class-ref in DealDetailsViewController.o "_OBJC_CLASS_$_GMSMapView", referenced from:
objc-class-ref in DealDetailsViewController.o "_OBJC_CLASS_$_GMSCameraPosition", referenced from:
objc-class-ref in DealDetailsViewController.o "_OBJC_CLASS_$_GMSServices", referenced from:
objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code
1 (use -v to see invocation)
I also tried using google map iOS sdk manual installation (without cocoapods). I have also added linker flag: -ObjC. It builds fine but crash on runtime showing selector not found error like this:
an NSException is thrown with the description -
-[GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance.
I just need to use google map iOS SDK either using cocoapod or from manual installation.
Am I missing anything here?
Edit
If there is anything related with Pods.xcconfig then here is the content of that file:
FRAMEWORK_SEARCH_PATHS = "$(PODS_ROOT)/Google-Maps-iOS-SDK" "$(PODS_ROOT)/Parse-iOS-SDK"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Bolts" "${PODS_ROOT}/Headers/Facebook-iOS-SDK" "${PODS_ROOT}/Headers/Facebook-iOS-SDK/FacebookSDK" "${PODS_ROOT}/Headers/Google-Maps-iOS-SDK" "${PODS_ROOT}/Headers/Google-Maps-iOS-SDK/GoogleMaps" "${PODS_ROOT}/Headers/MBProgressHUD" "${PODS_ROOT}/Headers/Parse-iOS-SDK" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/WYPopoverController"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/Bolts" -isystem "${PODS_ROOT}/Headers/Facebook-iOS-SDK" -isystem "${PODS_ROOT}/Headers/Facebook-iOS-SDK/FacebookSDK" -isystem "${PODS_ROOT}/Headers/Google-
Maps-iOS-SDK" -isystem "${PODS_ROOT}/Headers/Google-Maps-iOS-SDK/GoogleMaps" -isystem "${PODS_ROOT}/Headers/MBProgressHUD" -isystem "${PODS_ROOT}/Headers/Parse-iOS-SDK" -isystem "${PODS_ROOT}/Headers/Reachability" -isystem "${PODS_ROOT}/Headers/WYPopoverController"
OTHER_LDFLAGS = -ObjC -lc++ -licucore -lsqlite3 -lz -framework AVFoundation -framework AudioToolbox -framework CFNetwork -framework CoreData -framework CoreGraphics -framework CoreLocation -framework CoreText -framework GLKit -framework GoogleMaps -framework ImageIO -framework MobileCoreServices -framework OpenGLES -framework Parse -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -framework UIKit -weak_framework Accounts -weak_framework AdSupport -weak_framework Security -weak_framework Social
PODS_ROOT = ${SRCROOT}/Pods
It's looks like the linker cannot find a sdk lib. Headers are present, but sdk objects-file not linked to a project.
Checking this:
BuildSettings->Linking->Other Linker Flags must have a value $(inherited)
Did you follow all the steps mentioned below ?
Launch Xcode and either open an existing project, or create a new
project. If you're new to iOS, create a Single View Application, and
disable Use Storyboards but ensure that Use Automatic Reference
Counting is on.
Drag the GoogleMaps.framework bundle to the
Frameworks group of your project. When prompted, select Copy items
into destination group's folder.
Right-click GoogleMaps.framework in
your project, and select Show In Finder.
Drag the GoogleMaps.bundle
from the Resources folder to your project. We suggest putting it in
the Frameworks group. When prompted, ensure Copy items into
destination group's folder is not selected.
Select your project from
the Project Navigator, and choose your application's target. Open
the Build Phases tab, and within Link Binary with Libraries, add the
following frameworks:
AVFoundation.framework
CoreData.framework
CoreLocation.framework
CoreText.framework
GLKit.framework
ImageIO.framework
libc++.dylib
libicucore.dylib
libz.dylib
OpenGLES.framework
QuartzCore.framework
SystemConfiguration.framework
Choose your project, rather than a specific target, and open the Build Settings tab.
In the Other Linker Flags section, add -ObjC. If these settings are not visible, change the filter in the Build Settings bar from Basic to All.
Finally, add your API key to your AppDelegate.
#import <GoogleMaps/GoogleMaps.h>
Add the following to your application:didFinishLaunchingWithOptions: method, replacing API_KEY with your API key.
[GMSServices provideAPIKey:#"API_KEY"];
Source: Google
I often get the same error with other libs. I can't say the exact reason, but it happens when I switch between branches.
The workaround is plain:
remove workspace generated by cocoapods
clean project derived data Organiser -> Projects
run pod install
It always works for me.
try to play around in pod file's platform setting Vs deployment target in your Target:
platform :ios, '7.0'
then run pod update in terminal.
I have a project file with a Podfile that looks like this:
platform :ios, '7.0'
def import_pods
pod 'Specta', '0.1.8'
pod 'Expecta', '0.2.1'
pod 'RestKit', '0.20.3'
pod 'MagicalRecord', '2.1'
pod 'RestKit/Testing', '0.20.3'
end
link_with 'LocalMedTests'
import_pods
When I run pod install, it generates the Podfile.lock, Pods directory, and workspace for my project. When I open the workspace to build it, I get errors like this: 'RestKit.h' file not found.
It seems to only be an issue for RestKit but I can't get past those errors to see if there are more. The restkit headers are in Pods/Headers. They're properly included in Pods.xcconfig. Here it is for good measure:
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/Expecta" "${PODS_ROOT}/Headers/MagicalRecord" "${PODS_ROOT}/Headers/RestKit" "${PODS_ROOT}/Headers/RestKit/RestKit" "${PODS_ROOT}/Headers/RestKit/RestKit/CoreData" "${PODS_ROOT}/Headers/RestKit/RestKit/Network" "${PODS_ROOT}/Headers/RestKit/RestKit/ObjectMapping" "${PODS_ROOT}/Headers/RestKit/RestKit/Support" "${PODS_ROOT}/Headers/RestKit/RestKit/Testing" "${PODS_ROOT}/Headers/SOCKit" "${PODS_ROOT}/Headers/Specta" "${PODS_ROOT}/Headers/TransitionKit"
OTHER_LDFLAGS = -ObjC -framework CFNetwork -framework CoreData -framework Foundation -framework MobileCoreServices -framework Security -framework SenTestingKit -framework SystemConfiguration
PODS_ROOT = ${SRCROOT}/Pods
I've tried cleaning and cleaning the build folder. It doesn't matter - I always get the header not found error.
I should also add that all of the header directories specified by Pods.xcconfig are included in the target as they should be.
Any ideas about this? I've been using CocoaPods in this project for a couple of months with no issue, did something change recently?
This solved my Problem
In HEADER_SEARCH_PATHS Under your Project Build Setting add the $(inherited)
Also DO this for all TAGETS
Change Arcgitectures to Standard armv7
https://stackoverflow.com/a/12142790/1294448
For me, the problem was with Other Linker Flags and Runpath Search Paths, which weren't inheriting the settings defined on xcconfig. The following adjustments solved my problem:
Other Linker Flags:
$(inherited)
Runpath Search Paths:
$(inherited)
#executable_path/Frameworks
I only receive this error when my project compiles for running on an iOS device. Has anyone experienced an issue similar to this? I am attempting to run my project on a device. I have looked just about everywhere and am unable to find a solution. Any help on this would be appreciated.
Ld /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/McKendree.app/McKendree normal armv7
cd /Users/dapage/Developer/workspace/McKendree
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -L/Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos -L/Users/dapage/Developer/workspace/McKendree -L/Users/dapage/Developer/workspace/McKendree/Libraries -L/Users/dapage/Developer/workspace/McKendree/Libraries/OAuthConsumer -L/Users/dapage/Developer/workspace/McKendree/Libraries/TestFlight -L/Users/dapage/Developer/workspace/McKendree/../../../Downloads/TestFlightSDK1 -F/Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos -filelist "/Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Intermediates/McKendree University.build/Debug-iphoneos/McKendree.build/Objects-normal/armv7/McKendree.LinkFileList" -dead_strip -ObjC -fobjc-link-runtime -miphoneos-version-min=4.0 /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libThree20UI.a /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libThree20UICommon.a /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libThree20UINavigator.a /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libextThree20XML.a /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libThree20.a /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libThree20Core.a /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libThree20Network.a /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libThree20Style.a /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libTapkuLibrary.a -framework AddressBook -framework AddressBookUI -framework AudioToolbox -lz -framework QuartzCore -framework Foundation -framework UIKit -framework CoreGraphics -framework MapKit -framework MessageUI -framework MediaPlayer -framework AVFoundation -framework SystemConfiguration -framework CoreLocation -lxml2 -lsqlite3.0 -framework CFNetwork -framework Security -lOAuth -lTestFlight -o /Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/McKendree.app/McKendree\
The error is:
clang: error: no such file or directory: '/Users/dapage/Library/Developer/Xcode/DerivedData/McKendree_University-clkfusicbtxoumeeuoisuduipobw/Build/Products/Debug-iphoneos/libTapkuLibrary.a'
Make sure that the library binary is under the project root and that you add it as a reference. You can do this by selecting the project in the Project Navigator (Cmd-1) and then select Build Phases. Under Link Binary with Libraries you should have a reference to the binary. You may also want to add the library binary to your project, which may automatically at it as a linked binary. You can also edit Library Search Paths under Build Settings and add the folder where you have this binary file.
"$(SRCROOT)/lib"
If you have the binary in that folder it may find it easier that way. You will also need to reference headers for this library so look at setting Header Search Paths and adding the header files to your project.
If you can, I prefer to add code from third party libraries as Static Libraries and adding them as a dependency. You can do this first as a separate project and get it to build successfully on it's own. Then you can drag that project file into the other project in Xcode and set it up as a dependency. You will need to understand how schemes manage the build project for dependencies to set up a sub-project. You may find this approach to be much easier than linking to a pre-compiled library which may not include the required architectures for the devices that Apple releases. If you have the source code as a dependencies you will be able to build the necessary binary versions.