0
-(void)postExample {
NSURL *aUrl = [NSURL URLWithString:@"https://deluxecms.net/dev/api/index.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:aUrl
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSURLConnection *connection= [[NSURLConnection alloc] initWithRequest:request
delegate:self];
[request setHTTPMethod:@"POST"];
NSString *postString =
@"method=getDocument&deviceId=11a6b75c30fb0420ed2fccbc9d9cdf80&
cipher=52adabcb60014477b4cc82f35a032533&version=1&lastSync=0";
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
if(connection)
{
NSLog(@"Connection Successful");
}
else
{
NSLog(@"Connection could not be made");
}
}
一旦這條消息被執行,下面是顯示的錯誤。沒有得到服務器的響應
ConnectionExample[4869:11303] Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this
server is invalid. You might be connecting to a server that is pretending to be 「deluxecms.net」
which could put your confidential information at risk." UserInfo=0x75c2cb0
{NSErrorFailingURLStringKey=https://deluxecms.net/dev/api/index.php,
NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?,