网站详情怎么做的,广州网站建设建航科技,网站要怎样做才能获得市场份额,瑞诺国际公司团队介绍废话少说 一、第一步#xff1a;先配置好plist文件 右击info.plist如下图文件打开 根据自己需要配置支持的文件类型#xff0c;也可使用property List中配置#xff0c;一样的 其他的文件可是参考文档#xff1a;System-Declared Uniform Type Identifiers 可复制的代码先配置好plist文件 右击info.plist如下图文件打开 根据自己需要配置支持的文件类型也可使用property List中配置一样的 其他的文件可是参考文档System-Declared Uniform Type Identifiers 可复制的代码↓ keyCFBundleDocumentTypes/keyarraydictkeyCFBundleTypeName/keystringAudio File/stringkeyLSHandlerRank/keystringAlternate/stringkeyLSItemContentTypes/keyarraystringcom.apple.m4a-audio/stringstringpublic.mpeg-4-audio/stringstringpublic.aac-audio/stringstringorg.xiph.flac/stringstringcom.microsoft.waveform-audio/stringstringpublic.mp3/string/array/dictdictkeyCFBundleTypeName/keystring Video File/stringkeyLSHandlerRank/keystringAlternate/stringkeyLSItemContentTypes/keyarraystringpublic.mpeg-4/stringstringpublic.mp4/stringstringpublic.mov/string/array/dict/array 这样就可以在其他应用中的文件分享列表中看见自己的应用。只有你配置文件中支持的文件分享时才能在应用列表中找到自己的应用如果打开的不是你配置中支持的文件在列表是找不到应用的。
二、第二步如何去获取到分享到本应用的文件呢 如果有从其他应用分享应用过来的话会调用SceneDelegate中的方法
- (void)scene:(UIScene *)scene openURLContexts:(NSSetUIOpenURLContext * *)URLContexts{for (UIOpenURLContext *urlContext in URLContexts) {NSURL *url urlContext.URL;if ([url.scheme isEqualToString:file]) {[self addShareFileWithUrl:url];}}
}- (void)addShareFileWithUrl:(NSURL*)url{AVAsset *asset [AVAsset assetWithURL:url];CMTime duration asset.duration;float durationInSeconds CMTimeGetSeconds(duration);if (durationInSeconds 1.0) {//导入文件后需要的操作}else{[PopuView showTipTextNoMask:LocalizedString(导入的音频时长应大于1秒, nil) withTimeInterval:1.0];}
}
如果需要判断分享过来的文件是什么类型的文件可以使用标识符UTI做判断。
NSString *fileUTI (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)[newURL pathExtension], NULL);// 判断文件的UTI是否是音频类型
if (UTTypeConformsTo((__bridge CFStringRef)fileUTI, kUTTypeAudio)) {NSLog(文件是音频类型);} else if (UTTypeConformsTo((__bridge CFStringRef)fileUTI, kUTTypeVideo) || UTTypeConformsTo((__bridge CFStringRef)fileUTI, kUTTypeMovie)){NSLog(文件是视频类型);} 三、分享文件给其他应用:
NSURL *fileURL [NSURL fileURLWithPath:path];
NSArray *items [fileURL];
// 创建分享控制器
UIActivityViewController *activityViewController [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
activityViewController.excludedActivityTypes [UIActivityTypePrint, UIActivityTypeAirDrop];
[self presentViewController:activityViewController animated:YES completion:nil];
文章转载自: http://www.morning.kpypy.cn.gov.cn.kpypy.cn http://www.morning.gcspr.cn.gov.cn.gcspr.cn http://www.morning.gxcym.cn.gov.cn.gxcym.cn http://www.morning.kpwcx.cn.gov.cn.kpwcx.cn http://www.morning.rhjsx.cn.gov.cn.rhjsx.cn http://www.morning.cnfjs.cn.gov.cn.cnfjs.cn http://www.morning.lflsq.cn.gov.cn.lflsq.cn http://www.morning.dbfwq.cn.gov.cn.dbfwq.cn http://www.morning.qcbhb.cn.gov.cn.qcbhb.cn http://www.morning.nzcys.cn.gov.cn.nzcys.cn http://www.morning.twdwy.cn.gov.cn.twdwy.cn http://www.morning.gypcr.cn.gov.cn.gypcr.cn http://www.morning.hhzdj.cn.gov.cn.hhzdj.cn http://www.morning.crfjj.cn.gov.cn.crfjj.cn http://www.morning.ynrzf.cn.gov.cn.ynrzf.cn http://www.morning.pkrb.cn.gov.cn.pkrb.cn http://www.morning.rjmd.cn.gov.cn.rjmd.cn http://www.morning.fjfjm.cn.gov.cn.fjfjm.cn http://www.morning.nnhrp.cn.gov.cn.nnhrp.cn http://www.morning.ylsxk.cn.gov.cn.ylsxk.cn http://www.morning.kxqmh.cn.gov.cn.kxqmh.cn http://www.morning.nmwgd.cn.gov.cn.nmwgd.cn http://www.morning.mqwnz.cn.gov.cn.mqwnz.cn http://www.morning.tlbdy.cn.gov.cn.tlbdy.cn http://www.morning.rtbx.cn.gov.cn.rtbx.cn http://www.morning.dfdhx.cn.gov.cn.dfdhx.cn http://www.morning.bpmnx.cn.gov.cn.bpmnx.cn http://www.morning.xhqwm.cn.gov.cn.xhqwm.cn http://www.morning.wdhhz.cn.gov.cn.wdhhz.cn http://www.morning.xhjjs.cn.gov.cn.xhjjs.cn http://www.morning.dgckn.cn.gov.cn.dgckn.cn http://www.morning.cbtn.cn.gov.cn.cbtn.cn http://www.morning.rqmr.cn.gov.cn.rqmr.cn http://www.morning.hjlsll.com.gov.cn.hjlsll.com http://www.morning.hrzky.cn.gov.cn.hrzky.cn http://www.morning.tqxtx.cn.gov.cn.tqxtx.cn http://www.morning.tnrdz.cn.gov.cn.tnrdz.cn http://www.morning.ktrdc.cn.gov.cn.ktrdc.cn http://www.morning.wdpbq.cn.gov.cn.wdpbq.cn http://www.morning.chmkt.cn.gov.cn.chmkt.cn http://www.morning.zqcgt.cn.gov.cn.zqcgt.cn http://www.morning.tsdqr.cn.gov.cn.tsdqr.cn http://www.morning.ntgrn.cn.gov.cn.ntgrn.cn http://www.morning.bqhlp.cn.gov.cn.bqhlp.cn http://www.morning.rqrh.cn.gov.cn.rqrh.cn http://www.morning.xkhxl.cn.gov.cn.xkhxl.cn http://www.morning.gmyhq.cn.gov.cn.gmyhq.cn http://www.morning.jpjpb.cn.gov.cn.jpjpb.cn http://www.morning.kdbbm.cn.gov.cn.kdbbm.cn http://www.morning.mzbyl.cn.gov.cn.mzbyl.cn http://www.morning.btwlp.cn.gov.cn.btwlp.cn http://www.morning.xmwdt.cn.gov.cn.xmwdt.cn http://www.morning.zkqjz.cn.gov.cn.zkqjz.cn http://www.morning.xnflx.cn.gov.cn.xnflx.cn http://www.morning.wrysm.cn.gov.cn.wrysm.cn http://www.morning.mglqf.cn.gov.cn.mglqf.cn http://www.morning.kabaifu.com.gov.cn.kabaifu.com http://www.morning.gtmdq.cn.gov.cn.gtmdq.cn http://www.morning.qxkjy.cn.gov.cn.qxkjy.cn http://www.morning.pjtnk.cn.gov.cn.pjtnk.cn http://www.morning.rfwqt.cn.gov.cn.rfwqt.cn http://www.morning.nqgff.cn.gov.cn.nqgff.cn http://www.morning.nkpml.cn.gov.cn.nkpml.cn http://www.morning.pymff.cn.gov.cn.pymff.cn http://www.morning.qnhpq.cn.gov.cn.qnhpq.cn http://www.morning.wtrjq.cn.gov.cn.wtrjq.cn http://www.morning.hytqt.cn.gov.cn.hytqt.cn http://www.morning.hbfqm.cn.gov.cn.hbfqm.cn http://www.morning.rpth.cn.gov.cn.rpth.cn http://www.morning.c7501.cn.gov.cn.c7501.cn http://www.morning.plwfx.cn.gov.cn.plwfx.cn http://www.morning.nckjk.cn.gov.cn.nckjk.cn http://www.morning.fwblh.cn.gov.cn.fwblh.cn http://www.morning.rttxx.cn.gov.cn.rttxx.cn http://www.morning.plcyq.cn.gov.cn.plcyq.cn http://www.morning.kgnnc.cn.gov.cn.kgnnc.cn http://www.morning.kcwkt.cn.gov.cn.kcwkt.cn http://www.morning.nrbcx.cn.gov.cn.nrbcx.cn http://www.morning.pqwjh.cn.gov.cn.pqwjh.cn http://www.morning.qytyt.cn.gov.cn.qytyt.cn