swift – How do I share content material from my iOS app utilizing the usual iOS share sheet?

[ad_1]

It appears to be like just like the Share Extension permits different “host” apps to share content material with my “containing” app. How do I share content material from my app with different apps utilizing the usual iOS share sheet? I’ve discovered info on how you can use UISheetPresentationController and UIActivityViewController. What’s Apple’s designated customary API to share content material from my iOS app? I might assume their designated method would present all of the the apps that the share sheet can share with. Is UIActivityViewController the best way that’s most meant by Apple to do that?

This text appears to be like like a pleasant easy tutorial: UIActivityViewController by instance, however once I strive the primary phase of code that it teaches, it would not work just like the article says it ought to.

This is my code:

This is the debug window:

2022-10-20 21:08:10.536367-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [Default] Job TrialUIActivityV[34244]/1#3 LF=0 could not discover entitlement CopresenceCore.Entitlement.publicAPI error nil
2022-10-20 21:08:11.266049-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [Default] Job TrialUIActivityV[34244]/1#3 LF=0 could not discover entitlement CopresenceCore.Entitlement.publicAPI error nil
2022-10-20 21:08:12.000344-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [default] LaunchServices: retailer (null) or url (null) was nil: Error Area=NSOSStatusErrorDomain Code=-54 "course of might not map database" UserInfo={NSDebugDescription=course of might not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2022-10-20 21:08:12.001351-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [default] Try and map database failed: permission was denied. This try is not going to be retried.
2022-10-20 21:08:12.001421-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [db] Did not initialize shopper context with error Error Area=NSOSStatusErrorDomain Code=-54 "course of might not map database" UserInfo={NSDebugDescription=course of might not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2022-10-20 21:08:12.062430-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [default] -imageForImageDescriptor: can do IO please undertake -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (It will develop into a fault quickly.)
2022-10-20 21:08:12.199153-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [default] LaunchServices: retailer (null) or url (null) was nil: Error Area=NSOSStatusErrorDomain Code=-54 "course of might not map database" UserInfo={NSDebugDescription=course of might not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2022-10-20 21:08:12.199262-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [default] Try and map database failed: permission was denied. This try is not going to be retried.
2022-10-20 21:08:12.199340-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [db] Did not initialize shopper context with error Error Area=NSOSStatusErrorDomain Code=-54 "course of might not map database" UserInfo={NSDebugDescription=course of might not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2022-10-20 21:08:12.199640-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [default] -imageForImageDescriptor: can do IO please undertake -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (It will develop into a fault quickly.)
2022-10-20 21:08:12.240705-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [LayoutConstraints] Altering the translatesAutoresizingMaskIntoConstraints property of a UICollectionReusableView that's managed by a UICollectionView will not be supported, and can lead to incorrect self-sizing. View: <_UIActivityContentFooterView: 0x131d15bc0; baseClass = UICollectionReusableView; body = (16 474.5; 343 52); layer = <CALayer: 0x281180420>>
2022-10-20 21:08:13.864915-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [LayoutConstraints] Unable to concurrently fulfill constraints.
    Most likely not less than one of many constraints within the following listing is one you do not need. 
    Do that: 
        (1) take a look at every constraint and take a look at to determine which you do not anticipate; 
        (2) discover the code that added the undesirable constraint or constraints and repair it. 
(
    "<NSLayoutConstraint:0x283245f90 UIStackView:0x131d56460.centerY == UIView:0x131d54de0.centerY   (lively)>",
    "<NSLayoutConstraint:0x283246490 _UIActivityActionCellTitleLabel:0x131d55cc0.top >= 54.5   (lively)>",
    "<NSLayoutConstraint:0x283245ea0 V:|-(>=4)-[UIStackView:0x131d56460]   (lively, names: '|':UIView:0x131d54de0 )>",
    "<NSLayoutConstraint:0x283246850 'UISV-canvas-connection' UIStackView:0x131d56460.high == _UIActivityActionCellTitleLabel:0x131d55cc0.high   (lively)>",
    "<NSLayoutConstraint:0x2832468a0 'UISV-canvas-connection' V:[_UIActivityActionCellTitleLabel:0x131d55cc0]-(0)-|   (lively, names: '|':UIStackView:0x131d56460 )>",
    "<NSLayoutConstraint:0x28324e5d0 'UIView-Encapsulated-Format-Top' UIView:0x131d54de0.top == 30   (lively)>"
)

Will try to recuperate by breaking constraint 
<NSLayoutConstraint:0x283246490 _UIActivityActionCellTitleLabel:0x131d55cc0.top >= 54.5   (lively)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this within the debugger.
The strategies within the UIConstraintBasedLayoutDebugging class on UIView listed in <UIKitCore/UIView.h> might also be useful.
presentation finished
2022-10-20 21:08:18.385209-0500 TrialUIActivityViewControllerHackingWithSwiftPaulHudson[34244:1256968] [TraitCollection] Class CKBrowserSwitcherViewController overrides the -traitCollection getter, which isn't supported. If you happen to're attempting to override traits, you could use the suitable API.

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *