I've written an extension to share images to my web-service. The server is receiving the items without problem but something is happening on the server that execution is terminated before the expected state change.
I am trying to figure out how I can display a response from the web-server (like an error) after the post button has been hit in the share extension.
Is this possible? How can it be done?
my didSelectPost:
override func didSelectPost() {
let identifier = NSBundle.mainBundle().bundleIdentifier! + "." + NSUUID().UUIDString
let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(identifier)
configuration.sharedContainerIdentifier = "group.aa.com"
let session = NSURLSession(configuration: configuration)
let request = urlRequestWithImage(attachedImage, text: contentText)!
let task = NSURLSession.sharedSession().dataTaskWithRequest(request)
task.resume()
extensionContext?.completeRequestReturningItems([], completionHandler: nil)
}
In Xcode select the app running which is right between the STOP icon and the device selector. From there, choose the extension and run that in the simulator or on your attached device, now you will see the prints from your code in Xcode