美文网首页iOS 技术分享
iOS - 下载本地文件

iOS - 下载本地文件

作者: Joh蜗牛 | 来源:发表于2019-05-21 17:53 被阅读0次

    将文件放入项目中(文件名不能为中文)

    NSString *fileNameStr = @"Authorization";
    
        NSString *path = [[NSBundle mainBundle] pathForResource:fileNameStr ofType:@"doc"];
    
        NSString *encodedString = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    
        NSURL *url = [NSURL fileURLWithPath:encodedString];
    
        NSArray *dataAry = @[url];
        UIActivityViewController *activityController=[[UIActivityViewController alloc]initWithActivityItems:dataAry applicationActivities:nil];
        [self.navigationController presentViewController:activityController animated:YES completion:nil];
    
    
    

    相关文章

      网友评论

        本文标题:iOS - 下载本地文件

        本文链接:https://www.haomeiwen.com/subject/epxszqtx.html