This is the error I get when trying to share on iPad.
2016-08-13 17:25:50.817 BeerTracker[450:199013] *** Terminating app due to uncaught exception âNSGenericExceptionâ, reason: âUIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x1667d060>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.â
*** First throw call stack:
(0x2464791b 0x23de2e17 0x294b3485 0x28f13e93 0x28f11db3 0x28e6b4c9 0x28e777db 0x28bb5b1d 0x246096c9 0x246079cd 0x24607dff 0x24557229 0x24557015 0x25b47ac9 0x28c2b189 0x3fffc 0x241ff873)
libc++abi.dylib: terminating with uncaught exception of type NSException
And for the add photo button I get
2016-08-13 17:29:50.794 BeerTracker[454:200080] *** Terminating app due to uncaught exception âNSGenericExceptionâ, reason: âYour application has presented a UIAlertController (<UIAlertController: 0x15a85200>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controllerâs popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.â
*** First throw call stack:
(0x2464791b 0x23de2e17 0x294b3485 0x28f13e93 0x28f11db3 0x28e6b4c9 0x28e777db 0x28bb5b1d 0x246096c9 0x246079cd 0x24607dff 0x24557229 0x24557015 0x25b47ac9 0x28c2b189 0x43ffc 0x241ff873)
libc++abi.dylib: terminating with uncaught exception of type NSException
Thanks for this awesome tutorial. It worked great when I tried it out and it greatly helped me in releasing the newest version of my app (Shoptimizer). Users are now able to share their shopping lists and recipes.
The share file extension saves file to âdiskâ on iOS device.
// 5
let saveFileURL = path.appendingPathComponent(â/(name).btkrâ)
(contents as NSDictionary).write(to: saveFileURL, atomically: true)
return saveFileURL
How does this get cleaned up? Will the share extension automagically delete this source file after the âshareâ is done? Or will this storage just continue to grow with zombie-exports?
let activityViewController = UIActivityViewController(
activityItems: [âCheck out this beer I liked using Beer Tracker.â, url],
applicationActivities: nil)
insert the following:
activityViewController.completionWithItemsHandler = {
(activity, success, items, error) in
print("Activity: \(activity) Success: \(success) Items: \(items) Error: \(error)")
do {
try FileManager.default.removeItem(at: url)
print("File Removed from Documents Folder")
} catch {
print("Failed to remove item from Documents Folder")
}
}
Great tutorial saved me tons of time! Question: the file share works great in email and airdrop, but not in iMessage. The file shows, but tapping it causes no action. Any ideas?
@macandyp Great tutorial man. It works fine transferring bears using Air drop. But in email, email arrives, shows the file in email, but does not open the Beer in Beer tracker App. More over, canât post to facebook.
Can you help me in this regard?
This tutorial is more than six months old so questions regarding it are no longer supported for the moment. We will update it as soon as possible. Thank you! :]