海全,
在我的iphone项目中,我需要将用户名和密码传递给Web服务器,之前我使用GET方法传递数据并使用带有GET格式的URL(例如:localhost:8888/login?userName = admin&password = password)但是现在我需要将此作为POST数据发送,
任何人都可以帮我找到下面这段代码中的错误吗?
代码我试过..
NSString *post =[NSString stringWithFormat:@"userName=%@&password=%@",userName.text,password.text];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:@"https://localhost:443/SSLLogin/login.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSError *error;
NSURLResponse *response;
NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
NSLog(data);
Run Code Online (Sandbox Code Playgroud)
此页面将使用php echo返回成功或失败
是否可以使用 Apple 的新 SwiftUI 图表框架创建饼图/圆环图?
WWDC 视频中显示了饼图图像。任何有关如何创建饼图的帮助或代码示例将不胜感激。
有没有办法在iphone MapKit中显示行车路线?
有没有办法从谷歌MAPs API获取路径的坐标和名称作为XML或其他格式?例如,http://maps.google.com/maps?f = d&hl = zh-CN&geocode =&adddr = 39.23232,-103.343433&dddr = 41.23232,-104.344343&ie = UTF8&z = 12
在我的基于TabBar的iPhone应用程序中,我想在实际应用程序加载之前显示全屏欢迎页面(带有一些日志),如何从xib文件加载UIView作为欢迎屏幕,然后从那里我可以加载我的TabBar基础申请.