我使用这个库:https://github.com/robbiehanson/CocoaAsyncSocketGCDAsyncUdpSocket不编译为iOS
有在iPhone上TCP而不是UDP的例子。我认为一切都应该是一样的。这里是我的代码:
#import <UIKit/UIKit.h>
@class GCDAsyncUdpSocket;
@interface ThirdViewController : UIViewController
{
GCDAsyncUdpSocket *udpSocket;
}
.M:
#import "ThirdViewController.h"
#import "DDLog.h"
#import "DDTTYLogger.h"
#import "GCDAsyncUdpSocket.h"
static const int ddLogLevel = LOG_LEVEL_VERBOSE;
@implementation ThirdViewController
- (void)viewDidLoad
{
[DDLog addLogger:[DDTTYLogger sharedInstance]];
udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
}
但是当编译我得到的错误:为i386硬件架构
未定义的符号: “_OBJC_CLASS _ $ _ DDLog”,
引用来自: Objc-class-ref ThirdViewController.o“_OBJC_CLASS _ $ _ DDTTYLogger”, 参考来自: objc级-REF在ThirdViewController.o “_OBJC_CLASS _ $ _ GCDAsyncUdpSocket”, 从引用: objc级,裁判在ThirdViewController.o LD:符号(S)没有找到i386硬件架构
什么是错的?库中的示例编译时没有错误。
感谢您的回答!我不使用ARC。关于我遗忘的CFNetwork.framework,现在添加了一个链接,但错误依然存在。 – ifau 2012-03-25 08:33:00
现在你可能会有DDTTYLogger问题,你有没有AvFoundation库项目?您是否将DDLog的头文件链接到您的编译源? – mientus 2012-03-25 09:19:59
唉,我发现构建设置中的其他错误:) – ifau 2012-03-25 09:24:28