0

In my app, I have ca.crt in resources folder and I want to install it for the whole system (with user's acceptance).

I've tried:

NSString *path = [[NSBundle mainBundle] pathForResource:@"ca" ofType:@"crt"];
NSURL *url = [NSURL fileURLWithPath:path];
[[UIApplication sharedApplication] openURL:url];

but nothing happened.

[[UIApplication sharedApplication] canOpenURL:url];

returns false.

If I put cert on my web server and open it from Safari, everything works perfect (new system popup appears and ask me if I want to install CA cert). I need to repeat this behavior in app - is it possible?

zdolniacha
  • 203
  • 2
  • 10

1 Answers1

1

I'm not very sure about the certificate case, but if it has the same limitation (as my experience, yes) as .mobileconfig files in iOS, currently, the only way to install certificate files globally (cross apps) are using Safari or Mail app on iOS.

To install the certificate files, you have some choices like:

  1. Put the certificate files on the web and open it by Safari
  2. Send the certificate by email and open it by Mail app
  3. Package (or download) the certificate files to your bundle and host a HTTP server by your app, then open the localhost link by Safari through openURL: function.

You can refer following resource for installing mobileconfig file:

Downloading "mobileconfig" file from an App

Installing a configuration profile on iPhone - programmatically

Community
  • 1
  • 1
Charlie Hung
  • 1,197
  • 1
  • 17
  • 19