Pregunta

Estoy aprendiendo Restkit y quiero publicar datos de varias partes.

-(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];
}

Recibo estos errores:

  1. RKRequestMultipartBody no declarado
  2. RKRestRequest no declarado
  3. RKRestRequestPost no declarado
¿Fue útil?

Solución

Creo que el problema es causado por seguir un tutorial obsoleto. Las clases que causan un problema de compilación no están en la última API 0.9. Consulte la guía de mapeo de objetos más actualizado en github.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top