我掙扎在ASIFormDataRequest。
我要上傳Facebook上的照片在iphone讓我在編程中使用的一個ASIFormDataRequest,但它給我的錯誤,如_OBJC_CLASS_$_ASIFormDataRequest
,從引用:
我不明白它的意義,我怎麼能處理它
我上傳照片的代碼如下:
-(void)postphoto:(id)sender
{
UISegmentedControl* _segControl;
//ASIFormDataRequest *request;
UIImageView *_imageView = [UIImageView alloc];// initWithImage: image];
NSString *likeString;
NSString *filePath = nil;
if (_imageView.image == [UIImage imageNamed:@"angelina.jpg"]) {
filePath = [[NSBundle mainBundle] pathForResource:@"angelina" ofType:@"jpg"];
likeString = @"babe";
} else if (_imageView.image == [UIImage imageNamed:@"depp.jpg"]) {
filePath = [[NSBundle mainBundle] pathForResource:@"depp" ofType:@"jpg"];
likeString = @"dude";
} else if (_imageView.image == [UIImage imageNamed:@"maltese.jpg"]) {
filePath = [[NSBundle mainBundle] pathForResource:@"maltese" ofType:@"jpg"];
likeString = @"puppy";
}
if (filePath == nil) return;
NSString *adjectiveString;
if (_segControl.selectedSegmentIndex == 0) {
adjectiveString = @"cute";
} else {
adjectiveString = @"ugly";
}
NSString *message = [NSString stringWithFormat:@"I think this is a %@ %@!", adjectiveString, likeString];
NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/photos"];
//[ self setRequest:[ASIFormDataRequest requestWithURL:url]];
request = [ASIFormDataRequest requestWithURL:url];
[request addFile:filePath forKey:@"file"];
[request setPostValue:message forKey:@"message"];
//[request setPostValue:_accessToken forKey:@"access_token"];
[request setDidFinishSelector:@selector(sendToPhotosFinished:)];
[request setDelegate:self];
[request startAsynchronous];
}
我還添加了兩個文件ASIHTTPRequest.h
和ASIFormDataRequest.h
並將其導入,我寫我的代碼
我還添加了框架,如CFNetwork
,Foundation
等
請幫我解決這個錯誤。
PL告訴我如何可以鏈接我新,所以我不知道PL告訴我 – Yogesh 2011-04-26 05:30:35
它看起來像它的分佈的唯一來源(無xcodeproject)。只需將源代碼添加到項目中,並將源代碼編譯並鏈接到二進制文件(例如您的應用程序),就像任何其他源文件一樣。 – justin 2011-04-26 06:04:09
感謝我還添加源UT斯達康,但給我的錯誤 – Yogesh 2011-04-26 06:06:36