-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Description
Hi there. Thank you for taking the time to look through my issue. I'm willing to provide any info requested.
NOTE: this issue is not urgent, just mildly infuriating.
EDIT
It seems any error thrown the plugin (Flutter-side) is not visible when running flutter run, but is visible when using Xcode to run the project, regardless of whether the exception was thrown in the Swift code or in the Flutter plugin itself.
Preface
The plugin in question is called stapps_manager and is not available on GitHub, but the necessary files are here.
The plugin is created by running flutter create --template=plugin -i swift stapps_manager
- stapps_manager.dart
- SwiftStappsManagerPlugin.swift
- The example's main.dart and accompanying value_button_pair.dart that is just used for displaying values on screen.
Description
I'm running into a problem where, if I return an exception inside my swift file for my plugin (in this case, using a switch for the call.method, and running result(FlutterMethodNotImplemented) as default) the only thing the console returns is [VERBOSE-2:dart_error.cc(16)] Unhandled exception: without any additional information. I've tried to put a try-catch around my _channel.invokeMethod(...) catching all errors and putting them on screen, but it doesn't work.
When running the project in Xcode, this is the output:
2018-05-17 01:58:40.830897+0200 Runner[431:100776] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2018-05-17 01:58:40.894672+0200 Runner[431:100832] flutter: Observatory listening on http://127.0.0.1:51766/
2018-05-17 02:00:07.203528+0200 Runner[431:100823] [VERBOSE-2:dart_error.cc(16)] Unhandled exception:
MissingPluginException(No implementation found for method getTestString on channel nl.stapps.stapps_manager)
#0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
<asynchronous suspension>
#1 StappsManager.testString (package:stapps_manager/stapps_manager.dart:20:46)
<asynchronous suspension>
#2 _MyAppState._initTestString (file:///Users/jeroen/Projects/Stapps-Alpha/stapps_manager/example/lib/main.dart:38:45)
<asynchronous suspension>
#3 _VariableButtonPairState.build.<anonymous closure> (file:///Users/jeroen/Projects/Stapps-Alpha/stapps_manager/example/lib/main.dart:123:30)
#4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
#5 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
#6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
#7 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
#8 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
#9 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
#10 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
#11 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
#12 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
#13 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
#14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
#15 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
#16 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
#17 _invoke1 (dart:ui/hooks.dart:134:13)
#18 _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
So the error does occur, but it doesn't get passed to Flutter correctly, so I can't catch it (or read the error without running the project with Xcode).
Steps to Reproduce
I have tried to recreate the issue with the issue with the following steps, but it didn't work - the project runs like it should. Seems my project is cursed.
flutter create --template=plugin -i swift platformtest
cd platformtest
open ios/Classes/SwiftPlatformtestPlugin.swift
Change line 12 to
...
11 public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
12 result(FlutterMethodNotImplemented)
13 }
...cd example
flutter run
This should result in the console only outputting [VERBOSE-2:dart_error.cc(16)] Unhandled exception:, but it displays the error like it should, and using try{...} on MissingPluginException catch (e) { debugPrint(e.toString());} works fine, too.
Logs
flutter run --verbose BEFORE intentionally throwing the method-missing exception from swift (as far as my console could go).
After the error occurs:
[+356166 ms] [VERBOSE-2:dart_error.cc(16)] Unhandled exception:
flutter analyze
Analyzing /Users/jeroen/Projects/Stapps-Alpha/stapps_manager/example... hint • The value of the local variable 'testString' isn't used at lib/main.dart:45:12 • unused_local_variable
1 issue found.
(Ran in 5.8s)
flutter doctor -v
[✓] Flutter (Channel beta, v0.3.2, on Mac OS X 10.13.4 17E202, locale nl-NL)
• Flutter version 0.3.2 at /Users/jeroen/Development/flutter
• Framework revision 44b7e7d3f4 (4 weeks ago), 2018-04-20 01:02:44 -0700
• Engine revision 09d05a3891
• Dart version 2.0.0-dev.48.0.flutter-fe606f890b
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/jeroen/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4)
• Xcode at /Applications/Xcode-beta.app/Contents/Developer
• Xcode 9.4, Build version 9Q1019a
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 24.2.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] VS Code (version 1.23.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Dart Code extension version 2.12.1
[✓] Connected devices (2 available)
• iPhone van Jeroen Meijer • 0a6b212cab22ad19207521c159c5d8e305fe1e52 • ios • iOS 11.4
• iPhone X • 16CCF677-5656-40BA-9FF4-9C0813BAE91B • ios • iOS 11.4 (simulator)
• No issues found!