error in ASIFormDataRequest "_OBJC_CLASS_$_ASIFormDataRequest", referenced from:
I am struggling in ASIFormDataRequest.
I want to upload a photo on facebook in iphone so that I used a ASIFormDataRequest in my programming but it give me error like _OBJC_CLASS_$_ASIFormDataRequest
, referenced from:
I don't understand its meaning and how can I handle it
My code for uploading photo is as follows:
-(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 requestWit开发者_如何学编程hURL: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];
}
I also added two files ASIHTTPRequest.h
and ASIFormDataRequest.h
and imported it where I written my code
I have also added frameworks like CFNetwork
,Foundation
,etc
Please help me in solving this error.
I had a similar problem today. If you are using iOS 5 then make sure that all the files used from ASIHTTPRequest (which have a .m extension) are included in the project's compile source. you can check this by: project->target->build-phase->compile source.
if this is the case than try to add all the files and compile again. again if you are using ios 5 it will throw a lot more errors this time. all relating to ARC. to resolve this again go to the compile source, select all the library files (select only the file not using ios5 sdk) and flag them as "-fno-objc-arc". this will turn off the ARC on the selected files.
you have to link your binary with the library which has ASIFormDataRequest too.
精彩评论