当我部署它时,此代码在我的本地计算机上工作正常.它给出了Failure sending mail错误..请帮助...
MailAddress addrsTo = new MailAddress(toEmail);
MailAddress addrsFrom = new MailAddress("XXX@XXX.com", "XXX Title");
MailMessage mailmsg = new MailMessage(addrsFrom, addrsTo);
mailmsg.Subject = mailSbjct;
mailmsg.Body = "XXX Body";
SmtpClient smtp = new SmtpClient("mail.XXX.com");
smtp.EnableSsl = false;
smtp.Port = 26;
smtp.Credentials = new NetworkCredential("XXX@XXX.com", "XXXXXXX");
try {
smtp.Send(mailmsg);
} catch (Exception exc) {
throw new XXXException(1234, "---" + exc.Message);
}
Run Code Online (Sandbox Code Playgroud) 我想创建一个单元格对象的副本.以下是我的代码,但检索copyWithZone:]:发送到实例的无法识别的选择器
CollectionCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"KCell" forIndexPath:indexPath];
if(kCell == nil)
{
cell = [self getiPadCell:indexPath cv:cv dict:dict];
kCell = cell;
return cell;
}
else
{
cell = [kCell copy];
return cell;
}
Run Code Online (Sandbox Code Playgroud) 我想使用Web服务登录.
我的网站是基于https的.我正在使用以下教程.
http://agilewarrior.wordpress.com/2012/02/01/how-to-make-http-request-from-iphone-and-parse-json-result/
Run Code Online (Sandbox Code Playgroud)
以下代码工作正常.
responseData = [NSMutableData data];
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=AIzaSyAbgGH36jnyow0MbJNP4g6INkMXqgKFfHk"]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
Run Code Online (Sandbox Code Playgroud)
但我的代码是
responseData = [NSMutableData data];
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:@"https:myurl/login?userId=username&password=111111"]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
Run Code Online (Sandbox Code Playgroud)
它给出了错误
Connection failed: Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be --My URL-- which could put your confidential information at risk." UserInfo=0xa294260 {NSErrorFailingURLStringKey=https://mywebsite/login?userId=username&password=111111, NSLocalizedRecoverySuggestion=Would you like to connect to the server …Run Code Online (Sandbox Code Playgroud)