[英]Delphi XE4 iOS open email program not working
I am testing the following code on an iPhone4 (without sim card, but I don't see how that can matter since its mail program is otherwise working fine): 我正在iPhone4上测试以下代码(没有SIM卡,但是由于邮件程序正常运行,所以我看不出这有什么关系):
The SharedApplication and canOpenURL etc. are all routines provided by XE4. SharedApplication和canOpenURL等都是XE4提供的例程。
procedure TFormMain.sbContactsDetailsEmailClick(Sender: TObject);
var
S: string;
NSU: NSUrl;
begin
// URL.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding);
S := 'mailto:' + 'info@example.com' + '?subject=' + 'title' + '&body=';
NSU := StringToNSUrl(S);
if SharedApplication.canOpenURL(NSU) then
SharedApplication.openUrl(NSU)
;
end;
Unfortunately, it seems SharedApplication.canOpenURL(NSU) returns false. 不幸的是,似乎SharedApplication.canOpenURL(NSU)返回false。 Am I doing anything wrong?
我做错什么了吗?
I should have through of it myself, but here goes: 我本人应该已经完成它,但是这里有:
do work 做工作
'mailto:info@example.com?subject=test'
'mailto:info@example.com?subject=test%20test'
does not work 不起作用
'mailto:info@example.com?subject=test test'
(ie solution is to convert spaces to %20) (即解决方案是将空格转换为%20)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.