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"]];
where file.mobileconfig is downloaded in the root(localhost).
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. I ve made a directory in the app as root(localhost folder). And Downloaded files are saved in the localhost.
Resolved
I was trying to fetch the data from app sandbox i.e xyz.app/Web/file which is not possible because of sandboxing.
step 1: Check for file existence: How to check if a file exists in Documents folder?
In my code I made "Web" as root and download folder when I checked for download files existences it didn't exist.
Step 2:I have made Documents as root and files are downloaded to the Documents which is publicly accessible.
Step 3: I checked on my devices it was working.