{"id":1019,"date":"2020-09-01T22:16:48","date_gmt":"2020-09-01T14:16:48","guid":{"rendered":"http:\/\/123.57.164.21\/?p=1019"},"modified":"2020-09-01T22:16:48","modified_gmt":"2020-09-01T14:16:48","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8ios-11-app%e4%b8%ad%e6%98%be%e7%a4%badocuments%e6%96%87%e4%bb%b6%e5%a4%b9%e5%b9%b6%e4%b8%8e%e5%85%b6%e4%bb%96%e5%ba%94%e7%94%a8%e5%85%b1%e4%ba%ab","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=1019","title":{"rendered":"\u5982\u4f55\u5728iOS 11 App\u4e2d\u663e\u793aDocuments\u6587\u4ef6\u5939\u5e76\u4e0e\u5176\u4ed6\u5e94\u7528\u5171\u4eab"},"content":{"rendered":"\n<p><strong>1.info.plist\u91cc\u8ffd\u52a0\u4e24\u4e2a\u9879\u76ee\uff0c\u503c\u90fd\u662f&#8221;YES&#8221;\u3002<\/strong><\/p>\n\n\n\n<ul><li>UIFileSharingEnabled (Application supports iTunes file sharing)<\/li><li>LSSupportsOpeningDocumentsInPlace (Supports opening documents in place)<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-1024x439.png\" alt=\"\" class=\"wp-image-1020\" width=\"565\" height=\"242\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-1024x439.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-300x129.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-768x329.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-1536x659.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-830x356.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-230x99.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-350x150.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-480x206.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image.png 1894w\" sizes=\"(max-width: 565px) 100vw, 565px\" \/><\/figure><\/div>\n\n\n\n<p><strong>2.\u4fee\u6539\u4ee3\u7801\u3002<\/strong><\/p>\n\n\n\n<ul><li>\u5728\u7a0b\u5e8f\u52a0\u8f7d\u65f6\u5728Documents\u4e2d\u521b\u5efaApp\u4e13\u5c5e\u6587\u4ef6\u5939\u548c\u6587\u4ef6\u3002<\/li><li>\u53d6\u5f97App\u4e13\u5c5e\u6587\u4ef6\u5939\u91cc\u7684\u6587\u4ef6\u540dlist\u3002<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import UIKit\nimport SwiftUI\n\nclass SceneDelegate: UIResponder, UIWindowSceneDelegate {\n\n    var window: UIWindow?\n\n\n    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {\n        \/\/ Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.\n        \/\/ If using a storyboard, the `window` property will automatically be initialized and attached to the scene.\n        \/\/ This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).\n\n        \/\/ \u5728Documents\u91cc\u521b\u5efaApp\u4e13\u5c5e\u6587\u4ef6\u5939\u548c\u6587\u4ef6\n        let fm = FileManager.default\n        let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!\n        let filePath = documentsPath + \"\/myfile.txt\"\n        if !fm.fileExists(atPath: filePath) {\n            fm.createFile(atPath: filePath, contents: nil, attributes: [:])\n        }\n        \n        \/\/ \u6587\u4ef6\u540dlist\u53d6\u5f97\n        let documentDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]\n        var files = [\"\"]\n        do {\n            let contentUrls = try FileManager.default.contentsOfDirectory(at: documentDirectoryURL, includingPropertiesForKeys: nil)\n            files = contentUrls.map{$0.lastPathComponent}\n            print(files) \/\/-> [\"test1.txt\", \"test2.txt\"]\n        } catch {\n            print(error)\n        }\n        \n        \/\/ Create the SwiftUI view that provides the window contents.\n        \/\/ \u5c06\u6587\u4ef6\u540dlist\u4f20\u7ed9contentView\n        let contentView = ContentView(filesNameList: files)\n\n        \/\/ Use a UIHostingController as window root view controller.\n        if let windowScene = scene as? UIWindowScene {\n            let window = UIWindow(windowScene: windowScene)\n            window.rootViewController = UIHostingController(rootView: contentView)\n            self.window = window\n            window.makeKeyAndVisible()\n        }\n    }<\/pre>\n\n\n\n<p><strong>3.\u5c06App\u6587\u4ef6\u5939\u91cc\u7684\u6587\u4ef6\u540d\u663e\u793a\u5728\u753b\u9762\u4e0a\u3002<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"610\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-2-1024x610.png\" alt=\"\" class=\"wp-image-1022\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2-1024x610.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2-300x179.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2-768x458.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2-1536x915.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2-830x495.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2-230x137.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2-350x209.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2-480x286.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-2.png 1712w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p><strong>4.\u9a8c\u8bc1\u5bfc\u5165\u6587\u4ef6\uff0c\u6240\u4ee5\u7528iPhone\u624b\u673a\u6d4b\u8bd5\u3002<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"698\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-4-1024x698.png\" alt=\"\" class=\"wp-image-1024\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-4-1024x698.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-4-300x205.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-4-768x524.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-4-830x566.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-4-230x157.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-4-350x239.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-4-480x327.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-4.png 1332w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p><strong>5.\u7b2c\u4e00\u6b21\u5728\u624b\u673a\u4e0a\u52a0\u8f7dApp\uff0c\u9700\u8981\u5728\u624b\u673a\u4e0a\u5f00\u6743\u9650\u3002<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-5.png\" alt=\"\" class=\"wp-image-1025\" width=\"454\" height=\"1052\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-5.png 436w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-5-130x300.png 130w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-5-230x533.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-5-350x811.png 350w\" sizes=\"(max-width: 454px) 100vw, 454px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-6.png\" alt=\"\" class=\"wp-image-1026\" width=\"442\" height=\"1052\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-6-126x300.png 126w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-6-230x547.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-6-350x832.png 350w\" sizes=\"(max-width: 442px) 100vw, 442px\" \/><\/figure><\/div>\n\n\n\n<p><strong>6.\u8fd9\u662f\u7a0b\u5e8f\u542f\u52a8\u540e\u7684\u753b\u9762\uff0c\u663e\u793a\u4e86App\u6587\u4ef6\u5939\u4e0b\u7684\u6587\u4ef6\u3002<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"425\" height=\"1010\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-7.png\" alt=\"\" class=\"wp-image-1027\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-7.png 425w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-7-126x300.png 126w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-7-230x547.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-7-350x832.png 350w\" sizes=\"(max-width: 425px) 100vw, 425px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"425\" height=\"1009\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-8.png\" alt=\"\" class=\"wp-image-1028\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-8.png 425w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-8-126x300.png 126w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-8-230x546.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-8-350x831.png 350w\" sizes=\"(max-width: 425px) 100vw, 425px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"425\" height=\"1009\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-9.png\" alt=\"\" class=\"wp-image-1029\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-9.png 425w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-9-126x300.png 126w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-9-230x546.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-9-350x831.png 350w\" sizes=\"(max-width: 425px) 100vw, 425px\" \/><\/figure>\n\n\n\n<p><strong>7.\u624b\u673a\u8fde\u63a5Macbook\u540e\uff0c\u53ef\u4ee5\u5411App\u7684\u6587\u4ef6\u5939\u91cc\u5bfc\u5165\u9700\u8981\u7684\u6587\u4ef6\u3002\u8fd9\u6837App\u5c31\u53ef\u4ee5\u8bbf\u95ee\u8fd9\u4e9b\u6587\u4ef6\u4e86\u3002\u624b\u673a\u8fde\u63a5\u4ee5\u540e\uff0c\u9700\u8981\u5148\u540c\u6b65\u3002<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"507\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/09\/image-11-1024x507.png\" alt=\"\" class=\"wp-image-1031\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-1024x507.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-300x148.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-768x380.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-1536x760.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-2048x1013.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-830x411.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-230x114.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-350x173.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2020\/09\/image-11-480x238.png 480w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1.info.plist\u91cc\u8ffd\u52a0\u4e24\u4e2a\u9879\u76ee\uff0c\u503c\u90fd\u662f&#8221;YES&#8221;\u3002 UIFileSharing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1019"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1019"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1019\/revisions"}],"predecessor-version":[{"id":1033,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1019\/revisions\/1033"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}