我正在尝试加载我为iOS内容拦截器保存的文件,但我不断收到此日志,但它无法正常工作。这是我的代码和日志,我可以帮助我找到问题吗?
由于
可选(错误域= NSCocoaErrorDomain代码= 4097"连接到名为com.apple.SafariServices.ContentBlockerLoader&#34的服务; UserInfo = {NSDebugDescription =连接到名为com.apple.SafariServices.ContentBlockerLoader的服务})
import UIKit
import MobileCoreServices
class ActionRequestHandler: NSObject, NSExtensionRequestHandling {
func beginRequestWithExtensionContext(context: NSExtensionContext) {
let attachment = NSItemProvider(contentsOfURL: NSBundle.mainBundle().URLForResource("blockerList", withExtension: "json"))!
let item = NSExtensionItem()
item.attachments = [attachment]
if let urlToFile = BlackListManager.sharedInstance.urlToFile(), userFile = NSItemProvider(contentsOfURL: urlToFile) {
item.attachments = [userFile]
}
print(item.attachments)
context.completeRequestReturningItems([item], completionHandler: { expired in
print("%@", expired)
})
}
}