2012-02-24 75 views
1

我在一个URL中有一个.mobileconfig文件。我从xcode发送Http文章(当单击按钮时),http文章包含.mobileconfig网址。当按钮被点击时,我可以下载该文件吗?通过应用程序打开配置文件

回答

2

说到提供此文件。它需要用MIME内容类型的应用程序/ x-apple-aspen-config提供。您可以做到这一点通过添加一行到你的服务器的配置或.htaccess文件的文件夹中有:

<IfModule mod_mime.c> 
    AddType application/x-apple-aspen-config .mobileconfig 
</IfModule> 

如果在PHP服务的文件,你可以这样做:

header('Content-type: application/x-apple-aspen-config; charset=utf-8'); 
header('Content-Disposition: attachment; filename="company.mobileconfig"'); 
echo $mobileconfig; 
+0

否否。从iPhone你有没有从浏览器访问/下载.mobileconfig文件?当您访问该链接时,它将在一个单独的窗口中打开以进行安装。同样,我已经给出了应用程序中的链接,但它不像浏览器那样打开,也没有打开任何东西。我的问题是如何通过应用程序打开? – Cyril 2012-02-24 06:49:32

+0

对不起。太累了。我编辑了我的答案。 – dbrajkovic 2012-02-24 07:01:05

+0

charset拼写为chatset - 我试图编辑,但SO一直抱怨编辑大小小于6个字符。 – dazito 2016-06-29 10:13:19

0

小修正:那不是“chatset”,它是Charset。请确定您想要哪个字符集:

header('Content-type: application/x-apple-aspen-config; Charset=utf-8'); 
header('Content-Disposition: attachment; filename="company.mobileconfig"'); 
echo $mobileconfig; 
+0

这应该是对提供的答案的编辑或评论。 – EWit 2015-01-31 19:31:33

相关问题