使用RoutingHTTPServer重定向iOS mdm配置文件?

使用RoutingHTTPServer重定向iOS mdm配置文件?,ios,configuration,routing,profile,mdm,Ios,Configuration,Routing,Profile,Mdm,使用我的本机iOS应用程序设置MDM设备会将用户带出应用程序以加载Safari以启动MDM配置文件安装,然后返回Safari 我想做的是返回应用程序 我知道这可以通过文档记录来完成,但我似乎无法获得MDM配置文件Post请求来使用它 任何帮助,非常感谢。使用@xaphod的另一篇文章中的代码,我得到了如下效果,但仍然不是很好 基本上,我需要Safari加载配置文件,用户安装配置文件,然后单击“完成”,当Safari重新打开时,它将引导用户返回应用程序 我不认为这是可以做到的,也许最好的解决办法是

使用我的本机iOS应用程序设置MDM设备会将用户带出应用程序以加载Safari以启动MDM配置文件安装,然后返回Safari

我想做的是返回应用程序

我知道这可以通过文档记录来完成,但我似乎无法获得MDM配置文件Post请求来使用它


任何帮助,非常感谢。

使用@xaphod的另一篇文章中的代码,我得到了如下效果,但仍然不是很好

基本上,我需要Safari加载配置文件,用户安装配置文件,然后单击“完成”,当Safari重新打开时,它将引导用户返回应用程序

我不认为这是可以做到的,也许最好的解决办法是托管一个网页来重定向回应用程序

启动服务器和设置路由

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];
然后开始,

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://localhost:8000/start/"]];[/code]
它将使用JS计时器加载Safari

- (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>"];
}
- (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://"];
    }
}