Installing iOS Apps from a local plist (null) would like to install

喜你入骨 提交于 2019-12-01 04:09:07

问题


I'm trying to install an iOS app from a plist on the device's filesystem.

NSString *launchNewPlistURL = [NSString stringWithFormat:@"itms-services://?action=download-manifest&url=file://%@",[self saveFilePath]];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:launchNewPlistURL]];

And I'm prompted with "(null) would like to install {myappname}". Usually (null) is the domain name the plist is coming from, but in this case it's null as it's a local file.

Is there anyway to specify the title in the plist or pass a fake domain name in the url?

Thanks, Dan


回答1:


You can use the project MongooseDaemon to create an HTTP local server.

With a domain similar to: http://192.168.xxx.xxx/yourplist.plist to install it.

Anyhow, I think you can't use it with an large IPA. I have tried with my IPA greater than 15MB and it is very, very slow to start the install.




回答2:


I was in a similar situation, and went through the route of using Mongoose originally, but just today stumbled upon CocoaHttpServer.

With Mongoose, I was only getting about a 20% success rate serving up local plist/IPA files. Sometimes the localhost would like to install dialog never came up, sometimes install started and failed about halfway in, and sometimes it actually worked. Even worse, once an App failed, I had to completely uninstall and reinstall it, so all data was lost. I was never able to successfully "fix" a failed install.

So far, with just about 10-15 minutes of testing, the CocoaHttpServer hasn't failed, yet. I know this is a very small sample size, but my Mongoose success rate was around 10%.

self.httpServer = [[HTTPServer alloc] init];
[self.httpServer setType:@"_http._tcp."];
[self.httpServer setPort:8080];
//This is just a path where I save my IPA and Plist file locally.  
//In my case it's /{NSDocumentDirectory}/install/
[self.httpServer setDocumentRoot:[self pathForLocalInstallFiles]];

Then the URL to the plist on the disk:

NSURL *plistUrl = [NSURL URLWithString:@"itms-services://?action=download-manifest&url=http://localhost:8080/appname.plist"];
[[UIApplication sharedApplication] openURL:plistUrl];

Inside the plist, where you have your URL that points to the local IPA file, I had success using either file:// or http://localhost/.



来源:https://stackoverflow.com/questions/11250957/installing-ios-apps-from-a-local-plist-null-would-like-to-install

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!