小编KSi*_*att的帖子

iOS10中的OpenURL

显然OpenURL已经在iOS 10中被折旧.有没有人有任何关于为什么或可以解释下一步做什么的文档?我已经查看了Apple网站,发现了一些与OpenURL相关的内容,这就是他们现在所说的:

UIApplication.shared().open(url: URL, options: [String: AnyObject], completionHandler: ((Bool) -> Void)?)
Run Code Online (Sandbox Code Playgroud)

有没有人有证据表明这是在Swift 3.0中使用OpenURL的新方法?另外,options:completionHandler:参数分别使用什么值?

xcode openurl ios swift

45
推荐指数
4
解决办法
4万
查看次数

Swift 3 IOS 9和IOS 10核心数据

我在我的应用程序中使用核心数据.我希望该应用程序在iOS 9中打开,但事实并非如此.我该如何解决?

在此输入图像描述 在此输入图像描述

本节给出了警告.如何让它在iOS 9和iOS 10上运行?

    lazy var persistentContainer: NSPersistentContainer = {
        /*
         The persistent container for the application. This implementation
         creates and returns a container, having loaded the store for the
         application to it. This property is optional since there are legitimate
         error conditions that could cause the creation of the store to fail.
        */
        let container = NSPersistentContainer(name: "IndirimiKovala")
        container.loadPersistentStores(completionHandler: { (storeDescription, error) in
            if let error = error as NSError? {
                // Replace this implementation with code to …
Run Code Online (Sandbox Code Playgroud)

ios swift

12
推荐指数
1
解决办法
9147
查看次数

Swift中的UIActivities 3

尝试在我的应用程序中重新集成共享按钮.苹果再次改变了一些事情Swift 3iOS 10.我刚刚更新到Xcode 8发布版本,它一直在给我一些问题UIActivities.

发现它们中的许多现在UIActivityType.都是为了使编译器不会失败而开始的.然而,他们中的许多人仍在使用com.apple它也使我因某种原因将activityType数组转换为类型[Any].

那么......有谁知道他们为什么这样做?你在activityTypesToExclude.contains(where: (Any) throws -> Bool)方法中的for参数中放了什么?

 internal func _shouldExcludeActivityType(_ activity: UIActivity) -> Bool {

            let activityTypesToExclude = [

                "com.apple.reminders.RemindersEditorExtension",
                UIActivityType.openInIBooks,
                UIActivityType.print,
                UIActivityType.assignToContact,
                UIActivityType.postToWeibo,
                "com.google.Drive.ShareExtension",
                "com.apple.mobileslideshow.StreamShareService"

            ] as [Any]

            if let actType = activity.activityType {
                if activityTypesToExclude.contains(where: (Any) throws -> Bool) {
                    return true
                }
                else if super.excludedActivityTypes != nil {
                    return super.excludedActivityTypes!.contains(actType)
                }
            }
            return false
}
Run Code Online (Sandbox Code Playgroud)

ios swift swift3

2
推荐指数
1
解决办法
1449
查看次数

标签 统计

ios ×3

swift ×3

openurl ×1

swift3 ×1

xcode ×1