一个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) 我正在使用WebKit框架的WKWebView,在尝试提交到应用程序商店时,我收到此错误:
Your app contains non-public API usage. Please review the errors, correct them, and resubmit your application.
The app links to non-public libraries in Payload...: /System/Library/PrivateFrameworks/WebKit.framework/WebKit
Run Code Online (Sandbox Code Playgroud)
如果我将部署目标设置为8.0,那么错误就会消失,但我也想支持iOS 7.该错误似乎是iOS7也有WebKit框架的结果,但它当时是私有的.
因此,我想动态链接到WebKit库.我怎么能在XCode中做到这一点?
架构x86_64的未定义符号:"_ OBJC_CLASS _ $ _ WKWebView",引自:ld:未找到架构x86_64 clang的符号:错误:链接器命令失败,退出代码为1(使用-v查看调用)
任何帮助表示赞赏!
我想在IOS8上使用WKWebView,但也需要IOS7的兼容性,我看过帖子指的是使用这段代码:
if ([WKWebView class]) {
// do new webview stuff
}
else {
// do old webview stuff
}
Run Code Online (Sandbox Code Playgroud)
但不确定我做错了什么,因为下面的代码给我一个链接器错误:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_WKWebView", 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)
Run Code Online (Sandbox Code Playgroud)
任何帮助非常感谢,这是我的代码:
.h文件:
#import "WebKit/WebKit.h"
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIWebView *contentWebView;
@property (weak, nonatomic) IBOutlet WKWebView *contentWKWebView;
@end
Run Code Online (Sandbox Code Playgroud)
.m文件:
#import "ViewController.h"
@interface ViewController …Run Code Online (Sandbox Code Playgroud) objective-c ×3
xcode ×3
ios ×2
wkwebview ×2
cocoa ×1
iobluetooth ×1
ios8 ×1
macos ×1
webkit ×1
xcode7.3 ×1