从理论上讲,我们可以构建一个包含模拟器,iPhone和iPad的静态库.
但是,Apple没有关于此的文档,我可以找到,并且Xcode的默认模板未配置为执行此操作.
我正在寻找一种可以在Xcode中完成的简单,可移植,可重用的技术.
一些历史:
参考文献:
这是一个好主意,它是一种很好的方法,但它不起作用:http://www.drobnik.com/touch/2010/04/universal-static-libraries/
另一个提问者询问如何在不使用xcode的情况下执行此操作,以及专注于arm6与arm7部分的响应 - 但忽略了i386部分:如何为armv6,armv7和i386编译静态库(fat)
每次从CocoaPods导入文件时,我都会收到Apple Mach-O链接器错误.
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FBSession", referenced from: someFile
ld: symbol(s) not found for architecture arm64
Run Code Online (Sandbox Code Playgroud)
对于我使用的各种Pod,我得到了大约12个.
我正在尝试使用XCode 5为iPhone 5S构建.
我一直在尝试使用SO的各种解决方案,但还没有任何解决方案.
如何修复Apple Mach-O链接器错误?
刚发现另一个可能有趣的警告,我希望这能引导我找到解决方案:
Ignoring file ~/Library/Developer/Xcode/DerivedData/SomeApp/Build/Products/Debug-iphoneos/libPods.a,
Run Code Online (Sandbox Code Playgroud)
file was built for archive which is not the architecture being linked (arm64):~/Library/Developer/Xcode/DerivedData/someApp/Build/Products/Debug-iphoneos/libPods.a
一个Xcode初学者的问题:
这是我第一次使用Xcode 4.6.3.
我正在尝试编写一个非常简单的控制台程序,搜索配对的BT设备并将它们打印到NSLog.
它构建时出现以下错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_IOBluetoothDevice", referenced from:
objc-class-ref in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
我疯狂地搜索.常见问题应该是对文件的引用,其中只导入头文件,链接器不会找到实现(*.m-file).然而,IOBluetooth库是一个像Foundation Framework一样的标准框架.
我在上述陈述中缺少什么?
我也尝试过为32位机器构建它(再次构建失败).这显然是一个链接器错误,但我不知道它与它有什么关系,除了在x86和x64架构上找到IOBluetoothDevice的实现存在问题,而头文件来自标准包含的Framework,称为IOBluetooth?
为了您的信息,我的主要代码"main.m"是:
#import <Foundation/Foundation.h>
#import <IOBluetooth/objc/IOBluetoothDevice.h> // Note the import for bluetooth
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> // Note the import for bluetooth
int main(int argc, const char * argv[])
{
@autoreleasepool {
IOBluetoothDevice *currentDevice;
NSArray *devices = [ IOBluetoothDevice pairedDevices];
for (id …Run Code Online (Sandbox Code Playgroud) 尝试在现有应用程序中使用Layar SDK时出现以下错误.我怎么解决这个问题?
Ld /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos/hub.app/hub normal armv7
cd /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub
setenv IPHONEOS_DEPLOYMENT_TARGET 5.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.1.sdk -L/Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/ZBarSDK -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/Infosound/Lib -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/CrittercismSDK -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/UserVoiceSDK-2.0.4 -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/Libraries -F/Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos -F/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub -filelist /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Intermediates/hub.build/Debug-iphoneos/hub.build/Objects-normal/armv7/hub.LinkFileList -dead_strip -ObjC -all_load -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=5.0 -lMPOAuthMobile -lsbjson-ios -framework LayarSDK -framework Social -framework AddressBook -framework AddressBookUI -framework UIKit -framework QuartzCore -framework Twitter -framework SystemConfiguration -framework Security -framework OpenAL -framework OpenGLES -framework MessageUI -framework MediaPlayer -framework Foundation -framework CoreGraphics -lc++ -framework CoreTelephony -framework CoreVideo -framework CoreMotion -framework CoreMedia -framework CoreLocation -framework …Run Code Online (Sandbox Code Playgroud) 在我的iPhone项目中集成Zxing,QR码阅读器框架.我从这里检查了ZXing sdk .我运行了ZXing的示例项目,名为ScanTest,没有任何问题.但是当我尝试将库与我的项目集成时,我收到了提到的错误.
当我构建时,在完成ZXing自述文件中的每个集成步骤后,我都会遇到构建错误
Undefined symbols for architecture armv7:
"std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
zxing::qrcode::Detector::computeDimension(zxing::Ref<zxing::ResultPoint>, zxing::Ref<zxing::ResultPoint>, zxing::Ref<zxing::ResultPoint>, float) in libZXingWidget.a(Detector-B8B28E953F840D47.o)
Undefined symbols for architecture armv7:
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
zxing::Exception::Exception(char const*) in libZXingWidget.a(Exception.o)
zxing::common::StringUtils::guessEncoding(unsigned char*, int, std::map<unsigned int, std::string, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::string> …Run Code Online (Sandbox Code Playgroud) 在zxing iphone项目中,自述文件指出:
- 当尝试使用ZXingWidgetController构建自己的项目时,会发生链接器错误,例如"未定义引用".如果此错误看起来像c ++未定义的引用,那么将main.m重命名为main.mm(Objective-C++源后缀)可能会解决问题
确实如此.但我想知道为什么?
我偶然发现了一个我需要处理的项目问题.该项目使用Cocoapods来管理其库.我pod install像往常一样开始运行,但xcode给了我错误.我得到了Undefined symbols for architecture armv7你在下面的图片中看到的:

所有这些符号都是我用于项目的库.例如.AFNetworking,RNBlurModalView.我试图从项目中删除所有Cocoapods相关文件并pod install再次运行,但它仍然无法解决问题.
到目前为止我做了什么:
pod install再次运行.YES到NO.我也尝试了同样问题的解决方案,但没有一个对我有用.
如果它有帮助,我正在使用xCode6和Cocoapods 0.34.4.项目有效的架构是armv7 and armv7s.
更新:运行时pod install --verbose
Integrating client project
Integrating target `Pods` (`AIYOCore.xcodeproj` project)
[!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile: …Run Code Online (Sandbox Code Playgroud) 我有一个奇怪的链接器问题.我的代码看起来像这样:
double given_amount = self.modelController.levelCompleteRewardAmount;
swrve_currency_given(swrve, (CFStringRef)@"currencyName", given_amount);
Run Code Online (Sandbox Code Playgroud)
我在两个不同的地方有这个代码:在objective-c和objective-c ++文件中.它在objective-C land中编译很好,但是swrve_currency_given()函数在我的WGController.mm文件中导致以下内容:
Undefined symbols for architecture armv7:
"swrve_currency_given(Swrve*, __CFString const*, double)", referenced from:
-[WGController giveTheUserSomeCashForPlayingThisLevel] in WGController.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我不完全确定这个错误是否与Obj-C与C++有关,但感觉就像它.我的理论是它可能认为它是Obj-C类的一个函数?'swrve'代码是第三方代码,一个.h和.c文件,我像这样导入:
#import "swrve.h"
任何帮助表示赞赏!谢谢
我已经创建了一个新的iOS项目,并根据官方说明添加了Google Analytics支持.
我添加到框架:
libGoogleAnalyticsServices.a
AdSupport.framework
CoreData.framework
SystemConfiguration.framework
libz.dylib
Run Code Online (Sandbox Code Playgroud)
但它不适用于错误:
ld: warning: directory not found for option '-L/Users/.../Sources/GoogleAnalytics'
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSAttributeDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteErrorDomain", referenced from:
-[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteStoreType", referenced from:
-[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSOverwriteMergePolicy", referenced from:
-[GAIDataStore contextWithModel:URL:] …Run Code Online (Sandbox Code Playgroud) 我尝试在我的项目中导入解析框架.我确定我的项目很受欢迎,但是我找不到任何关于它是否是"电弧敏感"的信息.我的项目是基于弧的.
这是我得到的错误:
Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithName", referenced from:
-[PFCommandCache init] in Parse(PFCommandCache.o)
+[PFInternalUtils(Reachability) isParseReachable] in Parse(PFInternalUtils.o)
"_SCNetworkReachabilityGetFlags", referenced from:
___22-[PFCommandCache init]_block_invoke in Parse(PFCommandCache.o)
+[PFInternalUtils(Reachability) isParseReachable] in Parse(PFInternalUtils.o)
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[PFCommandCache init] in Parse(PFCommandCache.o)
"_SCNetworkReachabilitySetCallback", referenced from:
-[PFCommandCache init] in Parse(PFCommandCache.o)
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[PFCommandCache dealloc] in Parse(PFCommandCache.o)
"_SecItemAdd", referenced from:
+[PFInternalUtils saveToKeychain:data:] in Parse(PFInternalUtils.o)
"_SecItemCopyMatching", referenced from:
+[PFInternalUtils loadFromKeychain:] in Parse(PFInternalUtils.o)
"_SecItemDelete", referenced from:
+[PFInternalUtils saveToKeychain:data:] in Parse(PFInternalUtils.o)
+[PFInternalUtils deleteFromKeychain:] in Parse(PFInternalUtils.o)
"_UTTypeCopyPreferredTagWithClass", referenced from:
-[PFFile getMimeType] …Run Code Online (Sandbox Code Playgroud) ios ×6
xcode ×6
iphone ×3
cocoapods ×2
objective-c ×2
arm ×1
armv7 ×1
cocoa ×1
cocoa-touch ×1
frameworks ×1
iobluetooth ×1
ios6 ×1
macos ×1
xcode5 ×1
zxing ×1