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

Can't launch in ios #1181

Closed
kandangit opened this issue May 11, 2022 · 8 comments
Closed

Can't launch in ios #1181

kandangit opened this issue May 11, 2022 · 8 comments
Labels
bug Something isn't working waiting for customer response waiting for customer response

Comments

@kandangit
Copy link

Environment

-| Technology | Version |
| -------------------- | ------------- |
| Flutter version | 2.10.4 |
| Plugin version | 5.3.2 |
| iOS version | 15.4 |
| Xcode version | 13.3 |

Device information: Emulator: iPhone 11

Description

Expected behavior:

The app loads in the emulator with the inappbrowser working

Current behavior:

The app fails to run in the emulator:

[ +40 ms] Error running pod install
[ +3 ms] Error launching application on iPhone 11.

Steps to reproduce

fluter create --ios-language swift testflutter
cd testflutter
-- ADD dependency to pubspec.yaml: flutter_inappwebview: ^5.3.2
flutter pub get
flutter run

NOTES:

Have no issues in Android or in iOS with other Flutter apps that don't include the pluggin dependency.

Stacktrace/Logcat

[ +40 ms] Error running pod install
[ +3 ms] Error launching application on iPhone 11.
[ +6 ms] "flutter run" took 19.412ms.
[ +17 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:687:9)

#2 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1161:27)

#3 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)

#5 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)

#6 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)

#8 run.. (package:flutter_tools/runner.dart:62:9)

#9 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#10 main (package:flutter_tools/executable.dart:94:3)

@kandangit kandangit added the bug Something isn't working label May 11, 2022
@github-actions
Copy link

👋 @kandangit

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@yunchiri
Copy link

same error

@pichillilorenzo
Copy link
Owner

I cannot replicate your error. I have created a new fresh app (using Android Studio in my case) and it just works.
I'm using flutter_inappwebview: 5.4.3+7.

Here is my flutter doctor -v command result:

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.2.1 21D62 darwin-x64, locale it-IT)
    • Flutter version 2.10.4 at /Users/lorenzopichilli/fvm/versions/2.10.4
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c860cba910 (7 weeks ago), 2022-03-25 00:23:12 -0500
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc1)
    • Android SDK at /Users/lorenzopichilli/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0-rc1
    • ANDROID_HOME = /Users/lorenzopichilli/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/lorenzopichilli/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 4.1)
    • 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 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 212.5080.8

[✓] VS Code (version 1.66.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • iPhone 13 Pro (mobile) • A4121D94-1313-46CD-B0D1-36BFA91A8D57 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
    • macOS (desktop)        • macos                                • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 101.0.4951.54
    ! Error: iPhone di Lorenzo is not connected. Xcode will continue when iPhone di Lorenzo is connected. (code -13)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

This is my pubspec.yaml file:

name: flutter_inappwebview_test
description: A new Flutter application.

publish_to: 'none'

version: 1.0.0+1

environment:
  sdk: ">=2.16.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_inappwebview: 5.4.3+7
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^1.0.0

flutter:
  uses-material-design: true

And this is the example code:

import 'dart:async';
import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

Future main() async {
  WidgetsFlutterBinding.ensureInitialized();
  if (defaultTargetPlatform == TargetPlatform.android) {
    await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(kDebugMode);
  }
  runApp(const MaterialApp(
      home: MyApp()
  ));
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  final GlobalKey webViewKey = GlobalKey();

  InAppWebViewController? webViewController;
  InAppWebViewGroupOptions options = InAppWebViewGroupOptions(
    android: AndroidInAppWebViewOptions(
      useHybridComposition: true,
    ));

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text("InAppWebView TEST")),
        body: SafeArea(
            child: Column(children: <Widget>[
              Expanded(
                child: Stack(
                  children: [
                    InAppWebView(
                      key: webViewKey,
                      initialUrlRequest: URLRequest(
                          url: Uri.parse('https://github.com/flutter')),
                      initialOptions: options,
                      onWebViewCreated: (controller) {
                        webViewController = controller;
                      },
                      onLoadStart: (controller, url) {
                        log("onLoadStart $url");
                      },
                      onLoadStop: (controller, url) {
                        log("onLoadStop $url");
                      },
                    ),
                  ],
                ),
              ),
            ]))
    );
  }
}

Screen recording using iPhone 13 Pro Emulator of the code example:
Simulator Screen Recording - iPhone 13 Pro - 2022-05-11 at 23 23 43 mp4

@pichillilorenzo pichillilorenzo added the waiting for customer response waiting for customer response label May 11, 2022
@kandangit
Copy link
Author

Thanks for your quick response, I will take a further look. I believe this may be an environment issue, not sure yet. It is happening whenever I build the app (just the dependency added is enough) in iOS.

@yunchiri
Copy link

yunchiri commented May 17, 2022

Thanks for your quick response, I will take a further look. I believe this may be an environment issue, not sure yet. It is happening whenever I build the app (just the dependency added is enough) in iOS.

Are you working now?

my project not working
launch and crash when open webview in ios

But Android is work well

error log

terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The specified modal presentation style doesn't have a corresponding presentation controller.'

I removed then working fine

ios: IOSSafariOptions( dismissButtonStyle: IOSSafariDismissButtonStyle.CLOSE, <-- remove presentationStyle: IOSUIModalPresentationStyle.AUTOMATIC, <-- remove )

@kandangit
Copy link
Author

kandangit commented May 18, 2022

After some attempts I have removed developers' cache storage and restarted VS Code, and the project now loads ok (had also to reinstall Cocoa pods).

Have not come accross the specific issue you show but will test it more, thank you for the hint.

Will close the issue as it seems it was an environment issue (maybe those automatic O.S. updates). I had problems with other plugins, but it happened just tested this one first.

@kandangit
Copy link
Author

Solved. This was an environment issue.

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working waiting for customer response waiting for customer response
Projects
None yet
Development

No branches or pull requests

3 participants