我使用這個庫: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