集成Webview无法加载页面

来源:12-10 基于自定义WebView实现H5混合开发-3【H5混合实战】

马俊宝

2022-04-13

ios没有办法加载出页面
显示一片空白
,改成了git源码中的方式也不行

,我运行了 您的源码 ,ios也编译不通过

以下是git源码报错

This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
Take a look at the docs for migrating an app: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
Launching lib/main.dart on iPhone 12 Pro in debug mode...
Running pod install...
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Finding Podfile changes
      A webview_flutter_wkwebview
      R webview_flutter
      - Flutter
      - flutter_splash_screen

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `flutter_splash_screen` from `.symlinks/plugins/flutter_splash_screen/ios`
    -> Fetching podspec for `webview_flutter_wkwebview` from `.symlinks/plugins/webview_flutter_wkwebview/ios`

Error output from CocoaPods:
↳
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/rbconfig.rb:230: warning: Insecure world writable dir /opt/homebrew/bin in PATH, mode 040777
    /Users/majunbao/.gem/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x000000010101c000
    ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]

    -- Crash Report log information --------------------------------------------
       See Crash Report log file under the one of following:
         * ~/Library/Logs/DiagnosticReports
         * /Library/Logs/DiagnosticReports
       for more details.
    Don't forget to include the above Crash Report log file in bug reports.

    -- Control frame information -----------------------------------------------
    c:0049 p:---- s:0322 e:000321 CFUNC  :attach
    c:0048 p:0258 s:0316 e:000315 METHOD /Users/majunbao/.gem/gems/ffi-1.15.5/lib/ffi/library.rb:275
    c:0047 p:0050 s:0296 e:000295 CLASS  /Users/majunbao/.gem/gems/ethon-0.15.0/lib/ethon/libc.rb:17
    c:0046 p:0007 s:0293 e:000292 CLASS  /Users/majunbao/.gem/gems/ethon-0.15.0/lib/ethon/libc.rb:7
    c:0045 p:0007 s:0290 e:000289 TOP    /Users/majunbao/.gem/gems/ethon-0.15.0/lib/ethon/libc.rb:2 [FINISH]
    c:0044 p:---- s:0287 e:000286 CFUNC  :require
    c:0043 p:0187 s:0282 e:000281 METHOD /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85
    c:0042 p:0042 s:0265 e:000264 TOP    /Users/majunbao/.gem/gems/ethon-0.15.0/lib/ethon.rb:15 [FINISH]
    c:0041 p:---- s:0262 e:000261 CFUNC  :require
    c:0040 p:0187 s:0257 e:000256 METHOD /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85
    c:0039 p:0013 s:0240 e:000239 TOP    /Users/majunbao/.gem/gems/typhoeus-1.4.0/lib/typhoeus.rb:2 [FINISH]
    c:0038 p:---- s:0237 e:000236 CFUNC  :require
    c:0037 p:0187 s:0232 e:000231 METHOD /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85
    c:0036 p:0006 s:0215 e:000214 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:440
    c:0035 p:0045 s:0207 e:000206 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:372
    c:0034 p:0318 s:0196 e:000195 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:365
    c:0033 p:0006 s:0186 e:000185 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:338
    c:0032 p:0059 s:0181 e:000180 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:53
    c:0031 p:0021 s:0177 e:000176 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source.rb:31
    c:0030 p:0030 s:0172 e:000171 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:30 [FINISH]
    c:0029 p:---- s:0167 e:000166 CFUNC  :new
    c:0028 p:0068 s:0162 e:000158 BLOCK  /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:315 [FINISH]
    c:0027 p:0039 s:0154 E:000bc8 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:322
    c:0026 p:0007 s:0147 e:000146 BLOCK  /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:331 [FINISH]
    c:0025 p:---- s:0143 e:000142 CFUNC  :map
    c:0024 p:0006 s:0139 e:000138 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:331
    c:0023 p:0008 s:0133 e:000132 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:26
    c:0022 p:0004 s:0129 e:000128 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:60
    c:0021 p:0025 s:0125 e:000124 METHOD /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:393
    c:0020 p:0006 s:0120 e:000119 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/sources_manager.rb:22
    c:0019 p:0010 s:0115 e:000114 BLOCK  /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:178 [FINISH]
    c:0018 p:---- s:0111 e:000110 CFUNC  :map
    c:0017 p:0136 s:0107 e:000106 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:177
    c:0016 p:0024 s:0098 e:000093 BLOCK  /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1077
    c:0015 p:0081 s:0090 e:000089 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64
    c:0014 p:0078 s:0083 e:000082 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1076
    c:0013 p:0161 s:0076 e:000075 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:124
    c:0012 p:0011 s:0061 e:000060 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:416
    c:0011 p:0007 s:0056 e:000055 BLOCK  /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:241
    c:0010 p:0081 s:0053 e:000052 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64
    c:0009 p:0048 s:0046 e:000045 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:240
    c:0008 p:0009 s:0040 e:000039 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:161
    c:0007 p:0054 s:0036 e:000035 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52
    c:0006 p:0078 s:0031 e:000030 METHOD /Users/majunbao/.gem/gems/claide-1.1.0/lib/claide/command.rb:334
    c:0005 p:0024 s:0024 e:000023 METHOD /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52
    c:0004 p:0378 s:0019 e:000018 TOP    /Users/majunbao/.gem/gems/cocoapods-1.11.3/bin/pod:55 [FINISH]
    c:0003 p:---- s:0013 e:000012 CFUNC  :load
    c:0002 p:0120 s:0008 E:000330 EVAL   /Users/majunbao/.gem/bin/pod:25 [FINISH]
    c:0001 p:0000 s:0003 E:000610 (none) [FINISH]

    -- Ruby level backtrace information ----------------------------------------
    /Users/majunbao/.gem/bin/pod:25:in `<main>'
    /Users/majunbao/.gem/bin/pod:25:in `load'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
    /Users/majunbao/.gem/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:161:in `install!'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:416:in `analyze'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1077:in `block in resolve_dependencies'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:177:in `sources'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:177:in `map'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
    /Users/majunbao/.gem/gems/cocoapods-1.11.3/lib/cocoapods/sources_manager.rb:22:in `find_or_create_source_with_url'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:393:in `source_with_url'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:60:in `all'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:26:in `aggregate'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:331:in `aggregate_with_repos'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:331:in `map'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:331:in `block in aggregate_with_repos'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:322:in `source_from_path'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:315:in `block in source_from_path'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source/manager.rb:315:in `new'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:30:in `initialize'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source.rb:31:in `initialize'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:53:in `refresh_metadata'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
    /Users/majunbao/.gem/gems/cocoapods-core-1.11.3/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
    /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    /Users/majunbao/.gem/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
    /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    /Users/majunbao/.gem/gems/ethon-0.15.0/lib/ethon.rb:15:in `<top (required)>'
    /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    /Users/majunbao/.gem/gems/ethon-0.15.0/lib/ethon/libc.rb:2:in `<top (required)>'
    /Users/majunbao/.gem/gems/ethon-0.15.0/lib/ethon/libc.rb:7:in `<module:Ethon>'
    /Users/majunbao/.gem/gems/ethon-0.15.0/lib/ethon/libc.rb:17:in `<module:Libc>'
    /Users/majunbao/.gem/gems/ffi-1.15.5/lib/ffi/library.rb:275:in `attach_function'
    /Users/majunbao/.gem/gems/ffi-1.15.5/lib/ffi/library.rb:275:in `attach'

    -- Other runtime information -----------------------------------------------

    * Loaded script: /Users/majunbao/.gem/bin/pod

    * Loaded features:

        0 enumerator.so
        1 thread.rb
        2 rational.so
        3 complex.so
        4 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/enc/encdb.bundle
        5 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/enc/trans/transdb.bundle
        6 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/rbconfig.rb
        7 /Library/Ruby/Site/2.6.0/rubygems/compatibility.rb
        8 /Library/Ruby/Site/2.6.0/rubygems/defaults.rb
        9 /Library/Ruby/Site/2.6.0/rubygems/deprecate.rb
       10 /Library/Ruby/Site/2.6.0/rubygems/errors.rb
       11 /Library/Ruby/Site/2.6.0/rubygems/unknown_command_spell_checker.rb
       12 /Library/Ruby/Site/2.6.0/rubygems/exceptions.rb
       13 /Library/Ruby/Site/2.6.0/rubygems/basic_specification.rb
       14 /Library/Ruby/Site/2.6.0/rubygems/stub_specification.rb
       15 /Library/Ruby/Site/2.6.0/rubygems/platform.rb
       16 /Library/Ruby/Site/2.6.0/rubygems/version.rb
       17 /Library/Ruby/Site/2.6.0/rubygems/requirement.rb
       18 /Library/Ruby/Site/2.6.0/rubygems/util/list.rb
       19 /Library/Ruby/Site/2.6.0/rubygems/specification.rb
       20 /Library/Ruby/Site/2.6.0/rubygems/util.rb
       21 /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_gem.rb
       22 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/monitor.rb
       23 /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb
       24 /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_warn.rb
       25 /Library/Ruby/Site/2.6.0/rubygems.rb
       26 /Library/Ruby/Site/2.6.0/rubygems/dependency.rb
       27 /Library/Ruby/Site/2.6.0/rubygems/path_support.rb
       28 /Library/Ruby/Site/2.6.0/rubygems/tsort/lib/tsort.rb
       29 /Library/Ruby/Site/2.6.0/rubygems/tsort.rb
       30 /Library/Ruby/Site/2.6.0/rubygems/request_set/gem_dependency_api.rb
       31 /Library/Ruby/Site/2.6.0/rubygems/request_set/lockfile/parser.rb
       32 /Library/Ruby/Site/2.6.0/rubygems/request_set/lockfile/tokenizer.rb
       33 /Library/Ruby/Site/2.6.0/rubygems/request_set/lockfile.rb
       34 /Library/Ruby/Site/2.6.0/rubygems/request_set.rb
       35 /Library/Ruby/Site/2.6.0/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
       36 /Library/Ruby/Site/2.6.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb
       37 /Library/Ruby/Site/2.6.0/rubygems/resolver/molinillo/lib/molinillo/errors.rb
       38 /Library/Ruby/Site/2.6.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb
       39 /Library/Ruby/Site/2.6.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb
       40 /Library/Ruby/Site/2.6.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb
       41 /Library/Ruby/Site/2.6.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb
       42

    [NOTE]
    You may have encountered a bug in the Ruby interpreter or extension libraries.
    Bug reports are welcome.
    For details: https://www.ruby-lang.org/bugreport.html

    [IMPORTANT]
    Don't forget to include the Crash Report log file under
    DiagnosticReports directory in bug reports.


Error running pod install
Error launching application on iPhone 12 Pro.

以下是 我自己的报错

Performing hot reload...
Syncing files to device iPhone 12 Pro...
flutter: 马俊宝:https://m.ctrip.com/webapp/vacations/tour/around?&from=https%3A%2F%2Fm.ctrip.com%2Fhtml5%2F
Reloaded 0 libraries in 51ms.
flutter: 马俊宝:https://m.ctrip.com/webapp/vacations/tour/around?&from=https%3A%2F%2Fm.ctrip.com%2Fhtml5%2F
[VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: PlatformException(unregistered_view_type, trying to create a view with an unregistered type, unregistered view type: 'plugins.flutter.io/webview', null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
<asynchronous suspension>
#2      PlatformViewsService.initUiKitView (package:flutter/src/services/platform_views.dart:236:5)
<asynchronous suspension>
#3      _UiKitViewState._createNewUiKitView (package:flutter/src/widgets/platform_view.dart:639:44)
<asynchronous suspension>
写回答

1回答

CrazyCodeBoy

2022-04-14

flutter doctor检查下环境,然后将flutter升级到最新版看看

0
2
CrazyCodeBoy
有可能,你用真机运行看看是否OK呢
2022-04-15
共2条回复

Flutter从入门到进阶 实战携程网App 一网打尽核心技术

解锁Flutter开发新姿势,,系统掌握Flutter开发核心技术。

4788 学习 · 3270 问题

查看课程