Tag: ios extensions

扫描function在Action Extension上不起作用(没有相机开启扫描)

我能够实现button,tableview,textfields,开关…所有在ActionExtension工作正常 但 “扫描function”在“动作扩展”中不起作用(不扫描相机)。 下面我分享我的扫描代码迅速和截图我的扩展 声明: var scannedBarcode = NSString(string: "") var scannedMetadataOutput = AVCaptureMetadataOutput() var gCaptureMetadataOutput = AVCaptureMetadataOutput() var _prevLayer = AVCaptureVideoPreviewLayer() var _session = AVCaptureSession() 扫描button操作代码: @IBAction func scanExtenAction(sender: AnyObject) { scanExtAction.enabled = false var error:NSError? = nil //let _input = (try! AVCaptureDeviceInput.deviceInputWithDevice(gCaptureDevice)) let _input = (try! AVCaptureDeviceInput.init(device: gCaptureDevice)) if _session.canAddInput(_input) { _session.addInput(_input) } […]

当select多个相同types时,操作扩展激活规则谓词不隐藏操作

您好,我正在尝试使动作扩展到只与一个单一的GIF文件。 这里是我的代码(使用Apple的文档中提供的代码片断创build的: SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.compuserve.gif" ).@count == $extensionItem.attachments.@count ).@count == 1 这个扩展应该是在Photos应用程序内工作,我已经尝试了多个场景:单个GIF文件,单个非GIF文件,多个非GIF文件,GIF和非GIF文件的混合,以及多个GIF文件。 除了多个GIF文件,所有上述scheme都可以工作 – 如果我select多个项目,则会重新显示该操作。 我希望该操作只在使用单个GIF时出现。 我在做什么错在上面的谓词?

共享扩展程序的应用程序图标即使更新应用程序图标也不会在设备中更新

在我的iOS应用程序中,我有一个共享扩展。 最初我们正在使用不同的应用程序图标。 后来我们更改了应用程序的应用程序图标。 旧的图标已经从任何地方被replace,但是对于共享扩展,它不会被新图标取代。 以下是我们尝试过的方式,但并没有改变: 删除应用程序并重新安装。 – 不工作 删除派生的数据和重build应用程序并重新安装 – 没有工作。 如果有谁面临同样的问题,并得到解决呢?

如何在UIActivityViewController中添加应用程序

我正在开发一个应用程序,用户可以上传video到我们的服务器。 现在我想添加我的应用程序在UIActivityViewController所以从图库用户可以selectvideo,并打开我的应用程序,所以它会直接上传到我的服务器从画廊本身。 我如何将我的应用程序添加到UIActivityViewController ? 像这个截图中的Facebook,Vimeo和YouTube一样: 我已经在info.plist文件中编写了下面的代码,但它没有显示在应用程序中! <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>Video</string> <key>LSHandlerRank</key> <string>Alternate</string> <key>LSItemContentTypes</key> <array> <string>public.video</string> </array> </dict> </array> 我已经看到这个post,但我不明白如何做到这一点。

iOS 10不会调用通知服务扩展

我试图实现新的通知服务扩展,但我有一个问题。 在我的NotificationService.swift文件中,我有这样的代码: class NotificationService: UNNotificationServiceExtension { var contentHandler: ((UNNotificationContent) -> Void)? var bestAttemptContent: UNMutableNotificationContent? override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { self.contentHandler = contentHandler bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) if let bestAttemptContent = bestAttemptContent { // Modify the notification content here… bestAttemptContent.title = "\(bestAttemptContent.title) [modified]" print(bestAttemptContent.body) contentHandler(bestAttemptContent) } } override […]

ios 11的文件提供商扩展中的项目

我有一个文件提供商扩展的应用程序。 我尝试使用此链接支持与ios 11新的文件应用程序 我做了什么指示,但没有任何项目正在显示。 我也在我的plist中添加了这个NSExtensionFileProviderSupportsEnumeration = YES 。 ProviderEnumerator是我的NSFileProviderEnumerator类,其中ProviderItem是NSFileProviderItem。 在我的枚举类我有这个, func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) { observer.didEnumerate([ProviderItem(name: "raghav", type: "public.folder", identifier: "12334444", parentId: "-1"), ProviderItem(name: "panth", type: "public.folder", identifier: "12334444", parentId: "-1")]) var myInt = 100 let myIntData = Data(bytes: &myInt, count: MemoryLayout.size(ofValue: myInt)) observer.finishEnumerating(upTo: NSFileProviderPage(rawValue: myIntData)) } observer.didEnumerate()被调用,但视图没有被填充 我错过了什么!

如何设置NSExtensionActivationRule谓词?

即使是比我更聪明的人find了NSExtensionActivationRule奥术的语法,但即使是像我这样的傻瓜应该能够复制/粘贴的例子,没有? 不幸的是,我连苹果的例子都无法工作。 当您点击分享表button(下面的堆栈跟踪)时,我的操作扩展的主机应用程序崩溃。 你应该能够将NSExtensionActivationRule设置为一个string,对吗? 当我将其设置为TRUEPREDICATE以进行debugging时,它工作正常。 但是,如果我从苹果(稍微修改public.image )这个简单的例子,并将其粘贴,我得到一个崩溃: {extensionItems = ({ attachments = ({ registeredTypeIdentifiers = ( "public.image" ); }); })} 我也尝试了SUBQUERY东西: SUBQUERY($extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image").@count >= 1 理想情况下,我想通过使用NSExtensionActivationSupportsImageWithMaxCount来完全避免这种情况,但是当这个人发现时,似乎并没有为jpgs激活。 无论如何,这个堆栈跟踪如承诺: 2015-02-21 23:28:08.644 MobileSlideShow[56997:2414043] Communications error: <OS_xpc_error: <error: 0x4c985f4> { count = 1, contents = "XPCErrorDescription" => <string: 0x4c9883c> { length = 22, contents = […]

iOS共享扩展程序在Chrome中无法使用

适用于Safari,不适用于Chrome 也许这个问题很简单和愚蠢,但我是iOS开发新手,我找不到任何正确的解决scheme来解决这个问题。 我需要得到: 1)页面的url 2)页面名称 延期 的Info.plist <dict> <key>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <dict> <key>NSExrensionActivationSupportsText</key> <true/> <key>NSExtensionActivationSupportsFileWithMaxCount</key> <integer>1</integer> <key>NSExtensionActivationSupportsImageWithMaxCount</key> <integer>1</integer> <key>NSExtensionActivationSupportsMovieWithMaxCount</key> <integer>20</integer> <key>NSExtensionActivationSupportsWebPageWithMaxCount</key> <integer>1</integer> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key> <integer>0</integer> </dict> <key>NSExtensionJavaScriptPreprocessingFile</key> <string>DemoPreprocessor</string> </dict> <key>NSExtensionMainStoryboard</key> <string>MainInterface</string> <key>NSExtensionPointIdentifier</key> <string>com.apple.share-services</string> </dict> 我已经添加了更多的Chrome,但它仍然无法正常工作。 对于Safari来说,这已经足够了: NSExtensionActivationSupportsWebPageWithMaxCount, NSExtensionActivationSupportsWebURLWithMaxCount, NSExrensionActivationSupportsText, NSExtensionJavaScriptPreprocessingFile 我尝试了三种方法,使用和不使用DemoPreprocessor.js 。 但是,所有这些都不适用于Chrome: 1. ShareViewController.swift override func viewDidLoad() { super.viewDidLoad() let items = extensionContext?.inputItems var itemProvider: […]

如何在iOS / OS X上使用Crashlytics今天的扩展?

由于今天的扩展运行分离的过程,我相信他们不会logging任何崩溃的框。 我假设我们需要分别在小部件上初始化Crashlytics。 例如在TodayViewController的viewDidLoad方法中。 有没有人在任何iOS / OS X扩展中使用Crashlytics? 如果是的话,你是怎么实现的? 我也想知道在Crashlytics中创build一个单独的应用程序是否有意义。

iOs小工具后台更新

根据苹果关于widgetPerformUpdateWithCompletionHandler的说法,iOs Widget也可以在小部件不可见时更新他的内容。 在我的debugging会话中,我注意到todayViewController被释放,每当通知中心视图消失,所以我的问题是: 如果我的todayViewController如果被释放,可以如何响应widgetPerfomrUpdateWithComplationHandler? 我需要每小时更新他的内容,如果它不可见,我怎么做? iOs小部件生命周期如何? 请帮助我:)谢谢