Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 速递个人文件_Ios_Swift - Fatal编程技术网

Ios 速递个人文件

Ios 速递个人文件,ios,swift,Ios,Swift,我研究了一些有关IOS个人数据保护的主题,以用于应用程序演示。我可以访问文档目录并将所有文件从应用程序上载到服务器(或收集所有联系人列表)。这张照片在照相馆可以买到吗 是的,您可以使用照片从照片库中调出照片 下面是一个例子: import Photos class ViewController: UIViewController { @IBOutlet weak var tableView: UITableView! //Array of PHAsset type for storing p

我研究了一些有关IOS个人数据保护的主题,以用于应用程序演示。我可以访问文档目录并将所有文件从应用程序上载到服务器(或收集所有联系人列表)。这张照片在照相馆可以买到吗

是的,您可以使用照片从照片库中调出照片

下面是一个例子:

import Photos

class ViewController: UIViewController {

@IBOutlet weak var tableView: UITableView!
//Array of PHAsset type for storing photos
var images = [PHAsset]()
override func viewDidLoad() {
    super.viewDidLoad()
    self.tableView.delegate = self
    self.tableView.dataSource = self
    getImages()
    // Do any additional setup after loading the view, typically from a nib.
}

func getImages() {
    let assets = PHAsset.fetchAssets(with: PHAssetMediaType.image, options: nil)
    assets.enumerateObjects({ (object, count, stop) in
        // self.cameraAssets.add(object)
        self.images.append(object)
    })

    //In order to get latest image first, we just reverse the array
    self.images.reverse()

    self.tableView.reloadData()
}
}

extension ViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "cell")
    let imageAsset = self.images[indexPath.row]
    PHImageManager.default().requestImage(for: imageAsset, targetSize: CGSize(width: 120.0, height: 120.0), contentMode: .aspectFill, options: nil) { (result, _) in
        cell?.imageView?.image = result
    }
    return cell!
    }

    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return images.count
    }
    }

你是在问应用程序“是否可以访问照片库?”是的。在没有任何“拾取”功能的情况下访问和提取整个库。你尝试过我的答案吗?我要求在后台提取,而不是在任何地方提取任何内容。@AliIhsanURAL我已经更新了我的答案,请立即检查它是否有效@Mridul。但根据这一理论,所有应用程序都可以收集我们的库。苹果对此有什么保护措施吗?