Using RoutingHTTPServer to redirect iOS mdm configuration profile? -
using native ios app setup mdm device takes user out of app load safari initiate mdm configuration profile installation , returns safari.
what do, return application.
i know can done routinghttpserver documented here can't seem mdm configuration profile post request work it.
any help, appreciated.
using code in other post @xaphod, got working below it's still not good.
basically need safari load profile, user installs profile clicks done , when safari re-opens direct user app.
i don't think can done, maybe best workaround hosting webpage redirection app.
start server , setup routes
self.firsttime = true; self.httpserver = [[routinghttpserver alloc] init]; [self.httpserver setport:8000]; [self.httpserver handlemethod:@"get" withpath:@"/start" target:self selector:@selector(handlemobileconfigrootrequest:withresponse:)]; [self.httpserver handlemethod:@"get" withpath:@"/load" target:self selector:@selector(handlemobileconfigloadrequest:withresponse:)]; [self.httpserver start:null];
then begin,
[[uiapplication sharedapplication] openurl:[nsurl urlwithstring: @"http://localhost:8000/start/"]];[/code]
which load safari js timer
- (void)handlemobileconfigrootrequest:(routerequest *)request withresponse:(routeresponse *)response { [response respondwithstring:@"<html><head><title>profile install</title>\ </head><script> \ function load() { window.location.href='http://localhost:8000/load/';} \ var int=self.settimeout(function(){load()},600); \ </script><body></body></html>"]; }
first timer loads profile in safari, second re-direct app
- (void)handlemobileconfigloadrequest:(routerequest *)request withresponse:(routeresponse *)response { if (self.firsttime) { self.firsttime = false; nsdata *mobileconfigfile = [nsdata datawithcontentsofurl:[nsurl urlwithstring:@"http://mobileconfigfileurl"]]; [response setheader:@"content-type" value:@"application/x-apple-aspen-config"]; [response respondwithdata:mobileconfigfile]; } else { [response setstatuscode:302]; [response setheader:@"location" value:@"customappurl://"]; } }
Comments
Post a Comment