菜鸟教程小白 发表于 2022-12-11 18:21:26

ios - 迅速 3 : present does not work on iOS 9 and older


                                            <p><p>我正在尝试呈现一个 UIImagePickerController 并且当我使用时:</p>

<pre><code>self.present(picker, animated: true, completion: nil)
</code></pre>

<p>我得到这个错误:</p>

<pre><code>&#39;NSPersistentContainer&#39; is only available on iOS 10.0 or newer
</code></pre>

<p>我希望我的应用支持 iOS 8 及更高版本</p>

<p>编辑:
选择器代码:</p>

<pre><code>if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.photoLibrary) {
      var imagePicker = UIImagePickerController()
      imagePicker.delegate = self
      imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary
      imagePicker.allowsEditing = true
      self.present(imagePicker, animated: true, completion: nil)
    }
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>根据苹果文档:<a href="https://developer.apple.com/reference/coredata/nspersistentcontainer" rel="noreferrer noopener nofollow">https://developer.apple.com/reference/coredata/nspersistentcontainer</a> </p>

<p>我们可以在右侧看到:</p>

<blockquote>
<p>SDKs</p>

<p>iOS 10.0+<br/>
   macOS 10.12+<br/>
   tvOS 10.0+<br/>
   watchOS 3.0+</p>
</blockquote>

<p>表示如果你开发 iOS,<code>NSPersistentContainer</code> 只能在 iOS 10.0 或更新版本中使用。无法在 iOS 8 或低于 iOS 10 的系统中使用</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 迅速 3 : present does not work on iOS 9 and older,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/41233749/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/41233749/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 迅速 3 : present does not work on iOS 9 and older