fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.55k stars 928 forks source link

[Bug]: Share fails on iPad due to an "Attempt to map database" #2107

Open timovandeput opened 1 year ago

timovandeput commented 1 year ago

Platform

iOS 16.3.1

Plugin

share_plus

Version

7.1.0

Flutter SDK

3.13.1

Steps to reproduce

I used code similar to the documentation that triggers a share upon pressing a button.

This works as expected on Android, but fails on my iPad:

It only shows a white banner at the top of the screen, which can be dismissed by clicking outside it.

Note that I provided the sharePositionOrigin as documented, which on my device has a value of Rect.fromLTRB(0.0, 76.0, 834.0, 1112.0).

Code Sample

await Share.share(
  'Trying to share',
  subject: 'Subject to share',
  sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size,
);

Logs

[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] Attempt to map database failed: permission was denied. This attempt will not be retried.
[db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] Attempt to map database failed: permission was denied. This attempt will not be retried.
[db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x28299e0d0 h=-&- v=--& _UIActivityContentNavigationBar:0x106309d50.minY == 0   (active, names: '|':UILayoutContainerView:0x106307ae0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x28299e990 h=-&- v=--& _UIActivityContentNavigationBar:0x106309d50.height == 50   (active)>",
    "<NSLayoutConstraint:0x2829d4000 V:[_UIActivityContentNavigationBar:0x106309d50]-(0)-[UIFocusContainerGuide:0x2835c8000'UINavigationControllerContentFocusContainerGuide']   (active)>",
    "<NSLayoutConstraint:0x2829d68a0 UIFocusContainerGuide:0x2835c8000'UINavigationControllerContentFocusContainerGuide'.bottom == UILayoutContainerView:0x106307ae0.bottom   (active)>",
    "<NSLayoutConstraint:0x28299da90 V:|-(0)-[UILayoutContainerView:0x106307ae0]   (active, names: '|':UIView:0x1045ad620 )>",
    "<NSLayoutConstraint:0x28299da40 UILayoutContainerView:0x106307ae0.bottom == UIView:0x1045ad620.bottom   (active)>",
    "<NSLayoutConstraint:0x28299e120 'UIView-Encapsulated-Layout-Height' UIView:0x1045ad620.height == 26   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2829d4000 V:[_UIActivityContentNavigationBar:0x106309d50]-(0)-[UIFocusContainerGuide:0x2835c8000'UINavigationControllerContentFocusContainerGuide']   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] Attempt to map database failed: permission was denied. This attempt will not be retried.
[db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] Attempt to map database failed: permission was denied. This attempt will not be retried.
[db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] Attempt to map database failed: permission was denied. This attempt will not be retried.
[db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] -imageForImageDescriptor: can do IO please adopt -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (This will become a fault soon.)
[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] Attempt to map database failed: permission was denied. This attempt will not be retried.
[db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] Attempt to map database failed: permission was denied. This attempt will not be retried.
[db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
[default] -imageForImageDescriptor: can do IO please adopt -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (This will become a fault soon.)
[LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of a UICollectionReusableView that is managed by a UICollectionView is not supported, and will result in incorrect self-sizing. View: <_UIActivityContentFooterView: 0x127406b70; baseClass = UICollectionReusableView; frame = (16 342; 343 52); layer = <CALayer: 0x280a70200>>
[ShareSheet] connection invalidated

Flutter Doctor

[✓] Flutter (Channel stable, 3.13.0, on macOS 13.4.1 22F770820d darwin-x64, locale nl-NL)
    • Flutter version 3.13.0 on channel stable at /Users/timo/Work/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d9c6 (2 weeks ago), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/timo/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • ANDROID_HOME = /Users/timo/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

Checklist before submitting a bug

jonas-zebari commented 12 months ago

I am seeing the exact same issue as well. I haven't been able to make much sense of the logs.

ElDuderini commented 11 months ago

I've also gotten this issue with physical iPhone 13 pro max devices, tried that share position origin fix but didn't seem to work.

vbuberen commented 11 months ago

Seems like we already had a few similar issues, but there were no meaningful solution:

https://github.com/fluttercommunity/plus_plugins/issues/619 https://github.com/fluttercommunity/plus_plugins/issues/730

Note, in #730 it is mentioned that the issue happened only in debug builds.

Also, I Googled info about the error (something that the reporter supposed to do in the first place before marking the checkmark claiming so) and found such cases, which are not about share_plus or Flutter at all: https://developer.apple.com/forums/thread/688912 https://stackoverflow.com/questions/70311334/multiple-errors-with-uiactivityviewcontroller-in-swiftui

I don't have an iPad, but tried to reproduce on simulator with iOS 16.4 with both example app and a new project with share_plus added and couldn't see the same issue:

![Simulator Screenshot - iPad (10th generation) - 2023-09-30 at 13 14 25](https://github.com/fluttercommunity/plus_plugins/assets/13467769/f3d52f87-4862-44ab-acb2-0dc10da4b64a)

Thus, could somebody share a full code snippet of their page/screen? Especially curios which context you provide to call findRenderObject(). Did any of view wrapped the widget calling Share.share() with Builder() as suggested in docs and shown in the example app?

computerzman commented 10 months ago

I have the same error in Ipad only

tiagostorch commented 10 months ago

I have the same error in iphone

github-actions[bot] commented 7 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

timovandeput commented 4 months ago

Did anybody find a solution yet?

andreidevo commented 1 month ago

ipad rebuild helped!

And also Builder(builder:(context2) => GestureDetector( onTap: () async {

I added sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,