endigo / flutter_pdfview

PDF view for Flutter
https://pub.dev/packages/flutter_pdfview
MIT License
264 stars 218 forks source link

App crashed when package is used on iOS 18 #288

Closed ZXERSTON closed 1 month ago

ZXERSTON commented 1 month ago

Hi everyone,

I am facing this bug when running my flutter code on iOS. The app crashed only when I use my flutter_pdfview package. The app is able to be built but just crashed when that package is used.

Only happened to iOS 18

Tried looking for answers online but found none close to what I am experiencing. Hypothesis is something to do with the package.

Hope to get any insights. Thanks!

Logs:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'View was already initialized: <FLTPDFView: 0x7fede66371d0; frame = (0 0; 0 0); layer = <CALayer: 0x600002bc5f80>>'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000011c1b6369 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x0000000110017106 objc_exception_throw + 62
    2   Foundation                          0x00000001183bb6a8 _userInfoForFileAndLine + 0
    3   UIKitCore                           0x000000014b4670f8 -[UIView _populateInitialTraitCollection:] + 295
    4   UIKitCore                           0x000000014b467533 UIViewCommonInitWithFrame + 691
    5   UIKitCore                           0x000000014b467246 -[UIView initWithFrame:] + 95
    6   UIKitCore                           0x000000014b4668be -[UIView init] + 44
    7   flutter_pdfview                     0x000000010de29e09 -[FLTPDFView initWithFrame:arguments:controler:] + 185
    8   flutter_pdfview                     0x000000010de29753 -[FLTPDFViewController initWithFrame:viewIdentifier:arguments:binaryMessenger:] + 243
    9   flutter_pdfview                     0x000000010de295e0 -[FLTPDFViewFactory createWithFrame:viewIdentifier:arguments:] + 128
    10  Flutter                             0x00000001291988cd _ZN7flutter30FlutterPlatformViewsController8OnCreateEP17FlutterMethodCallRU13block_pointerFvP11objc_objectE + 491
    11  Flutter                             0x000000012919094a __47-[FlutterEngine maybeSetupPlatformViewChannels]_block_invoke.231 + 60
    12  Flutter                             0x00000001298072eb __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 168
    13  Flutter                             0x00000001291bd472 ___ZN7flutter25PlatformMessageHandlerIos21HandlePlatformMessageENSt21_LIBCPP_ABI_NAMESPACE10unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE_block_invoke + 94
    14  libdispatch.dylib                   0x00000001171dab3d _dispatch_call_block_and_release + 12
    15  libdispatch.dylib                   0x00000001171dbec6 _dispatch_client_callout + 8
    16  libdispatch.dylib                   0x00000001171ebd1d _dispatch_main_queue_drain + 1357
    17  libdispatch.dylib                   0x00000001171eb7c2 _dispatch_main_queue_callback_4CF + 31
    18  CoreFoundation                      0x000000011c11545f __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    19  CoreFoundation                      0x000000011c10fd87 __CFRunLoopRun + 2515
    20  CoreFoundation                      0x000000011c10efb3 CFRunLoopRunSpecific + 536
    21  GraphicsServices                    0x000000013342d0cb GSEventRunModal + 137
    22  UIKitCore                           0x000000014ad4bc3b -[UIApplication _run] + 875
    23  UIKitCore                           0x000000014ad50b7c UIApplicationMain + 123
    24  Runner.debug.dylib                  0x000000010e07ca1f __debug_main_executable_dylib_entry_point + 63
    25  dyld                                0x000000010d038478 start_sim + 10
    26  ???                                 0x0000000204cf32cd 0x0 + 8670622413
)
libc++abi: terminating due to uncaught exception of type NSException```

Flutter doctor:

[✓] Flutter (Channel stable, 3.16.5, on macOS 15.0.1 24A348 darwin-arm64, locale en-GB)
    • Flutter version 3.16.5 on channel stable at /Users/zxerston/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (10 months ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/zxerston/Library/Android/sdk
    • Platform android-34, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.94.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (3 available)
    • iPhone 16 Pro Max (mobile) • AD57B575-28BE-48A4-8003-A6DBA20DFB82 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-0 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 15.0.1 24A348 darwin-arm64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 129.0.6668.100
    ! Error: Browsing on the local area network for YONG XUN’s iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

• No issues found!
endigo commented 1 month ago

@ZXERSTON please update to the latest version Duplicate of #286