문제

I am learning RestKit, and I want to post multi-part data.

-(void)publishToServer:(AddTextObj *)aTextObj
{
    NSString *urlString =appDelegate.textUploadURL;
    RKRequestMultipartBody *body = [[RKRequestMultipartBody alloc] init];
    [body addField:"phoneNo" text:aTextObj.phoneNumber];
    [body addField:"name" text:aTextObj.userName];
[body addField:"messageText" text:aTextObj.messageText];
[body addField:"imei" text:aTextObj.imeiNumber];
[body addField:"latitude" text:aTextObj.latitude];
[body addField:"longitude" text:aTextObj.longitude];
[body addField:"messageTitle" text:aTextObj.messageTitle];
[body addField:"picture" image:aTextObj.picture fileName:@"picture.png"];   
[body finalizeBody];
RKRestRequest *rest = [[RKRequest alloc] 
                       initWithURL:[NSURL URLWithString:urlString] 
                       requestBody:body];
rest.delegate = self;
rest.requestMethod = RKRestRequestPost;
[rest go];
}

I'm getting these errors:

  1. RKRequestMultipartBody undeclared
  2. RKRestRequest undeclared
  3. RKRestRequestPost undeclared
도움이 되었습니까?

해결책

I believe the problem is caused by following an outdated tutorial. The classes that cause compilation problem are not in the latest 0.9 API. Please, refer to the most up-to-date Object Mapping guide on github.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top