我正在开发一个使用照片共享扩展程序的iOS应用程序,其中处理图像并触发我们的主要功能.
在Photo的应用程序的模拟器中,这很好用.我决定使用Photo的应用程序在设备上运行它也很棒,但是当我截图并尝试从iOS 11的新"快速截图"分享时,扩展程序崩溃,任何想法?
扩展程序获取图像,将其发送到服务器,获取响应并显示该响应(所有内容都在扩展中).当我从快速截图访问时,Messenger和Snapchat共享扩展仍然有用,这让我很烦恼!
Xcode 9也没有给我任何来自共享扩展的日志.同样值得注意的是,每次我在设备上重新安装应用程序时,我都在使用我需要"信任"的开发者帐户.
码:
// App Group keys
let suiteName = "group.suite.id"
override func viewDidLoad() {
print("Styling views..")
styleViews()
print("Styled views")
print("Adding notifications..")
addNotifications()
print("Added notifications")
print("Fetching image..")
fetchSharedImage()
}
func styleViews(){
// Set up main view
mainView.layer.cornerRadius = 8
mainShadowView.addShadow()
// Set up views and buttons
// Code hidden, applies shadows etc.
// Code hidden, moves constraints of a view
}
func addNotifications(){
// Helps views tell their parent (this view controller) to navigate to another …Run Code Online (Sandbox Code Playgroud)