美文网首页
获取服务器下载的文件类型

获取服务器下载的文件类型

作者: 我是菜鸟66666 | 来源:发表于2017-01-15 11:16 被阅读0次

[NSURLConnectionsendAsynchronousRequest:requestqueue:[[NSOperationQueuealloc]init]completionHandler:^(NSURLResponse*_Nullableresponse,NSData*_Nullabledata,NSError*_NullableconnectionError) {

//出错则返回

if(connectionError !=nil) {

NSLog(@"connectionError = %@",connectionError);

return;

}else{

//通过NSURLResponse类来获取文件的类型

NSLog(@"%@",response.MIMEType);//获取文件的类型如:text/plain

NSLog(@"%@",response.suggestedFilename);//获取文件名加后缀如:LOG_20170115100747.txt

}

相关文章

网友评论

      本文标题:获取服务器下载的文件类型

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