Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lost connection to device - when authorizing Reader SDK #45

Closed
tonydiaz opened this issue May 18, 2020 · 10 comments
Closed

Lost connection to device - when authorizing Reader SDK #45

tonydiaz opened this issue May 18, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@tonydiaz
Copy link

tonydiaz commented May 18, 2020

Describe the issue

I'm seeing the reader-sdk-flutter-plugin/example project is losing connection to physical iPhone device as I authorize the Read SDK.

I'm running an iPhone 8 with iOS 13.3.1. Update: I updated to 13.4.1, same result.

There isn't a good trace on the error just loses the connection at the end.

Error log details:

Running "flutter pub get" in example...                             1.0s
Launching lib/main.dart on iPhone 8 in debug mode...
Upgrading project.pbxproj
Legacy build system detected, removing <PROJECT_PATH>/reader-sdk-flutter-plugin/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
Signing iOS app for device deployment using developer identity: "iPhone Developer: <EMAIL> (<ID>)"
Running pod install...                                              2.3s
Warning: Podfile is out of date
This can cause a mismatched version of Flutter to be embedded in your app, which may result in App Store submission rejection or crashes.
If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/24641 for instructions.
To regenerate the Podfile, run:
rm ios/Podfile

Running Xcode build...
Xcode build done.                                           74.5s
Installing and launching...                                        55.7s
Debug service listening on ws://localhost:1024/ws
Syncing files to device iPhone 8...
Lost connection to device.

To Reproduce

Steps to reproduce the issue.

  1. Start project
  2. Authorize the Microphone and Location permissions
  3. Go to square developer site and generate mobile auth code in production
  4. Given permission to use the camera on the app.
  5. Use app to scan the QR code and then app crashes on the physical device (Lost connection to device.)

You can use the example project to reproduce the issue. I'm having the same problem on my project

  void authorize(String authCode) async {
    try {
      setState(() {
        _isLoading = true;
      });
      print('AuthCode: $authCode');
      var location = await 
            ReaderSdk.authorize(authCode); // ReaderSdk.authorize loses connection to device
      print('Location: $location'); //Never gets to this print statement
    } on ReaderSdkException catch (e) {
      ...
    } finally {
      setState(() {
        _isLoading = false;
      });
    }
  }

Expected behavior

The app should not crash when authorizing the SDK.

This works fine on the iPhone emulator. I wanted to test the physical card readers ao I need to run it on a physical device.

Environment (please complete the following information):

  • platform: iOS
  • OS and version: iOS 13.3.1
  • dev environment: iPhone 8 physical device
  • Reader SDK version: 2.1.0

[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.3 19D76, locale en-US)
• Flutter version 1.17.1 at <FLUTTTER_PATH>/flutter
• Framework revision f7a6a7906b (6 days ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at <ANDRIOD_PATH>/Library/Android/sdk
• Platform android-29, build-tools 29.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] VS Code (version 1.44.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
• iPhone 8 • 0a036d2c82dbb4ec0222a931b233080e8559f452 • ios • iOS 13.3.1
• iPhone 11 • 10F248D4-85D8-445C-B340-0298AD318A49 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

! Doctor found issues in 1 category.

Screenshots

Additional context

@tonydiaz tonydiaz added the bug Something isn't working label May 18, 2020
@StephenJosey
Copy link
Collaborator

I believe this is related to the In-App Payments SDK same issue: square/in-app-payments-flutter-plugin#82 which is basically due to breaking changes from Flutter 1.12 >. I believe you need to use an older version of Flutter for this to work.

@tonydiaz
Copy link
Author

Downgrading the flutter version is tough since that cascades to downgrading other packages that don't work on < 1.12 version of flutter.

Is there any other workaround to test out the functionality?

Looks like from the other issues there is no ETA on developing a fix?

@StephenJosey
Copy link
Collaborator

Unfortunately I'm not aware of a workaround, nor do I have an ETA on updating this.

@tonydiaz
Copy link
Author

I'm seeing the issue on Flutter version 1.11.0 as well using the example project in this repo using a physical device

Log details:

Launching lib/main.dart on My iPhone 8 in debug mode...
Signing iOS app for device deployment using developer identity: "iPhone Developer: <APPLE_ID> (<ID_NUMBER>)"
Warning: Podfile is out of date
  This can cause a mismatched version of Flutter to be embedded in your app, which may result in App Store submission rejection or crashes.
  If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/24641 for instructions.
To regenerate the Podfile, run:
  rm ios/Podfile

Running Xcode build...
Xcode build done.                                           64.1s
Installing and launching...
Debug service listening on ws://127.0.0.1:1024/vhyJdE_J9PI=/ws
Syncing files to device My iPhone 8...
Lost connection to device.

The application loads. I tried scanning the QR for the Mobile Auth Code and entering it manually the app crashes for both ways. After the crash the app only loads the image below and crashes again.

image

Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.11.0, on Mac OS X 10.15.3 19D76, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[✓] Android Studio (version 3.6)
[!] VS Code (version 1.44.0)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

@tonydiaz
Copy link
Author

@StephenJosey @okenshields Is there a way I can trace the problem better? Hard to figure out the root cause when the error is only Lost connection to device

@StephenJosey
Copy link
Collaborator

Apologies for the delay here, I will escalate to the team and follow up once I have more information.

@tonydiaz
Copy link
Author

After some updates, I'm not no longer seeing this problem in my application. I'm not sure of any significant change I made that resolved it but I no longer have the disconnection.

I did implement an endpoint for the Mobile auth

I ran the example app again and used the camera to scan the QR Mobile Auth Code in the developer console. It lost the connection again. I wonder if there is something different with the auth code generated in the developer console versus the Mobile Auth API?

Not sure if you want me to close the issue. It would be nice if it is possible to have a stack trace error when a connection is lost.

@mohsin-sq
Copy link
Collaborator

Hi @tonydiaz,

Do you know if this happens when running on a physical android device as well? We recently did upgrade our plugins to Flutter 1.12+. Unfortunately I don't have a physical iPhone accessible to test it out.

@tonydiaz
Copy link
Author

tonydiaz commented Jul 8, 2020

@mohsin-sq This only happened to me on a physical device. I only tried it on an iPhone.

I never had an issue with the android and iOS emulators.

My application now works but running the example project in the repo on my physical device still loses connection.

@mohsin-sq
Copy link
Collaborator

This ended up just being an issue with the example application. Some information in the info.plist was missing that is required for running on a physical device. After it was added, the application worked. Thanks for bringing this to our attention @tonydiaz ! Closing the issue, please feel free to reopen if you have any more questions regarding this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants