我必须设计一个iOS应用程序,它将下载一个pdf文件,并且会有一个“打开” UIActivityViewController
(UIActivity
子类化)。使用OpenUrl
我将数据发送到另一个应用程序,我可以在第二个应用程序中获取pdf数据。
但我也希望 Safari 具有相同的功能。我想在 Safari 中查看第二个应用程序“打开方式”,一旦用户在 Safari 中获得一些 pdf,用户可以单击打开方式在第二个应用程序中获取 pdf 数据。
- (void)performActivity {
NSString *urlstring=@"ran/jan/jena/getit";
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"ranjantest:///%@",urlstring]];
BOOL checkurl=[[UIApplication sharedApplication]canOpenURL:URL];
if(checkurl){
[[UIApplication sharedApplication] openURL:URL];
}else{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"" message:@"No suitable App installed" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
}
有什么建议怎么做吗?