无法在Safari iOS设备中打开mobileconfig文件 [英] Unable to open mobileconfig file in Safari ios devices

查看:196
本文介绍了无法在Safari iOS设备中打开mobileconfig文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个应用程序,它将mobileconfig从我的服务器下载到我的ios应用程序.我创建了一个运行后台的服务器,并使用openUrl在Safari中打开它,以便用户可以安装配置文件.但是它只能在模拟器中使用,而不能在我的设备上使用.

I am making an app where it downloads mobileconfig from my server to my ios app. And I've created a server running background and used openUrl to open it in the safari so user can install the profile. But it only works in the simulator but not on my device.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://localhost:12345/file.mobileconfig"]];

在root(localhost)中下载file.mobileconfig.

where file.mobileconfig is downloaded in the root(localhost).

我已经实现了此解决方案:已保存打开的.mobileconfig文件在Safari iOS中的应用但是它在模拟器上可以正常工作,但是当我在设备上运行该文件时却无法获取文件.

A.I ve implemented this solution: Open .mobileconfig file saved in application in safari ios but it works fine on the simulator but it doesn't fetch the files when I run it in the device.

B.我已经在应用程序中创建了一个目录作为root(localhost文件夹).并且下载的文件保存在本地主机中.

B. I ve made a directory in the app as root(localhost folder). And Downloaded files are saved in the localhost.

我试图从应用沙箱中获取数据,即xyz.app/Web/file由于沙箱操作而无法使用.

I was trying to fetch the data from app sandbox i.e xyz.app/Web/file which is not possible because of sandboxing.

步骤1:检查文件是否存在:如何检查文件文件夹中是否存在文件?

step 1: Check for file existence: How to check if a file exists in Documents folder?

在我的代码中,我创建了"Web"作为根目录和下载文件夹,当我检查下载文件是否存在时.

In my code I made "Web" as root and download folder when I checked for download files existences it didn't exist.

第2步:我已将文档设为根目录,并将文件下载到可公开访问的文档中.

Step 2:I have made Documents as root and files are downloaded to the Documents which is publicly accessible.

第3步:我检查了我的设备是否正常运行.

Step 3: I checked on my devices it was working.

推荐答案

这是因为设备内部的 localhost 是设备本身.您必须将 localhost 替换为计算机的LAN ip地址(而不是 127.0.0.1 ).

That's because localhost inside the device is the device itself. You have to replace localhost with the LAN ip address of your computer (and it's not 127.0.0.1).

这篇关于无法在Safari iOS设备中打开mobileconfig文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆