0

我有注册表单,其中有名字、姓氏、性别、电子邮件、密码、用户图像、年龄等字段。我想通过 php webservice 调用将此用户信息保存在服务器上。如何将这些参数传递给服务 url?我会使用使用 post 方法的 http 请求将用户信息保存到服务器,当该用户想要登录 iOS 应用程序时,我可能会匹配该用户的凭据。在岸上,我需要为我的 iOS 应用程序登录和注册屏幕,请向我推荐任何教程

在此先感谢大家

4

1 回答 1

1

首先您需要创建 php 脚本,然后通过 NSURL 传输数据。

NSURL * url=[NSURL URLWithString:[NSString stringWithFormat:@"http://192.168.0.6/savedevicedata.php?Udid=%@&Flag=%d&DateTime=%@",uniqueIdentifier,Flag,FinalDate]];

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    NSLog(@"%@",request);
    [request setHTTPMethod:@"POST"];
    //[request setHTTPBody:[NSString stringWithFormat:@"%@",rawStr]];       

    NSURLResponse *response;
    NSError *err;
    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
    NSLog(@"responseData: %@", responseData);

试试这个代码只是替换你的领域。

于 2013-08-01T13:33:47.480 回答