0

下午好,

我正在关注有关 IOS 9.3.5 上的 Ipad 的 Windows 7 教程:

https://medium.com/flutter-community/developing-and-debugging-flutter-apps-for-ios-without-a-mac-8d362a8ec667 我一直在重建 Flutter Tool。(教程的最后一部分)

我下载(从教程的链接)并复制C:\src\flutter\binlibimobiledeviceideviceinstaller哪些二进制文件中。然后我运行了git apply ios.diff,这给了我多个错误,有时只是关于 mac.dart,有时更像是这样:

error: patch failed: packages/flutter_tools/lib/src/ios/devices.dart:103
error: packages/flutter_tools/lib/src/ios/devices.dart: patch does not apply
error: patch failed: packages/flutter_tools/lib/src/ios/ios_workflow.dart:26
error: packages/flutter_tools/lib/src/ios/ios_workflow.dart: patch does not apply
error: patch failed: packages/flutter_tools/lib/src/ios/mac.dart:124
error: packages/flutter_tools/lib/src/ios/mac.dart: patch does not apply

然后我在这里找到了这个命令:git:patch does not apply

git apply --reject --whitespace=fix mychanges.patch 

我得到的是:(不要介意 的内容Future<String>,这是因为我已经将其更改为应有的内容)

Checking patch packages/flutter_tools/lib/src/ios/mac.dart...
error: while searching for:
  Future<String> getAvailableDeviceIDs() async {
    try {
      final ProcessResult result = await processManager.run(<String>['idevice_id', '-l']);
      if (result.exitCode != 0)
        throw ToolExit('idevice_id returned an error:\n${result.stderr}');
      return result.stdout;
    } on ProcessException {
      throw ToolExit('Failed to invoke idevice_id. Run flutter doctor.');

error: patch failed: packages/flutter_tools/lib/src/ios/mac.dart:124
Applying patch packages/flutter_tools/lib/src/ios/devices.dart with 1 reject...
Rejected hunk #1.
Applying patch packages/flutter_tools/lib/src/ios/ios_workflow.dart with 1 reject...
Rejected hunk #1.
Applying patch packages/flutter_tools/lib/src/ios/mac.dart with 1 reject...
Rejected hunk #1.

此时我在mac.dart文件中手动粘贴了正确的内容(正如您可能在上面的错误中看到的那样),但我仍然不确定一切是否顺利,因为:

error: patch failed: packages/flutter_tools/lib/src/ios/mac.dart:124

无论如何,我继续运行命令来重建颤振工具:

bin\cache\dart-sdk\bin\dart --snapshot=.\bin\cache\flutter_tools.snapshot --packages=.\packages\flutter_tools\.packages .\packages\flutter_tools\bin\flutter_tools.dart

最后,输出是这样的:

C:\src\flutter>bin\cache\dart-sdk\bin\dart --snapshot=.\bin\cache\flutter_tools.snapshot --packages=.\packages\flutter_tools\.packages .\
packages\flutter_tools\bin\flutter_tools.dart
packages/flutter_tools/lib/src/ios/ios_workflow.dart:20:30: Error: Getter not found: 'iMobileDevice'.
  bool get canListDevices => iMobileDevice.isInstalled || (xcode.isInstalledAndMeetsVersionCheck && xcode.isSimctlInstalled);
                             ^^^^^^^^^^^^^
packages/flutter_tools/lib/src/ios/ios_workflow.dart:20:30: Error: The getter 'iMobileDevice' isn't defined for the class 'IOSWorkflow'.
 - 'IOSWorkflow' is from 'package:flutter_tools/src/ios/ios_workflow.dart' ('packages/flutter_tools/lib/src/ios/ios_workflow.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'iMobileDevice'.
  bool get canListDevices => iMobileDevice.isInstalled || (xcode.isInstalledAndMeetsVersionCheck && xcode.isSimctlInstalled);
                             ^^^^^^^^^^^^^

这个“iMobileDevice”是否与这个 libimobiledevice 相关?我可以运行任何ideviceinstaller.exeor idevice_id.exe,所以我想我正确安装了它。

我错过了纠正此错误的重要内容?

非常感谢您的时间:)

4

2 回答 2

1

在“ios_workflow.dart”文件中,您必须将其写入其他“导入...”行的位置:

导入“mac.dart”;

对我来说,它解决了问题。

于 2019-10-09T16:23:45.377 回答
0

非常感谢 !导入“mac.dart”让我可以正确应用所有内容。

然后我跑了flutter attach,这就是我得到的:(我想只有第一行有用)

D:\Beerproject>flutter attach

Sending crash report to Google.
Crash report sent (report ID: 5d71ca5958062efd)
Oops; flutter has exited unexpectedly.

Sending crash report to Google.
Crash report sent (report ID: 5024a42feb468e2b)
Oops; flutter has exited unexpectedly.
Unhandled exception:
Unsupported operation: Control of iOS devices or simulators only supported on Mac OS.
#0      IOSDevice.getAttachedDevices (package:flutter_tools/src/ios/devices.dart:172:7)
<asynchronous suspension>
#1      IOSDevices.pollingGetDevices (package:flutter_tools/src/ios/devices.dart:117:57)
#2      PollingDeviceDiscovery.devices (package:flutter_tools/src/device.dart:270:52)
<asynchronous suspension>
#3      DeviceManager.getAllConnectedDevices (package:flutter_tools/src/device.dart:136:46)
<asynchronous suspension>
#4      DeviceValidator.validate (package:flutter_tools/src/doctor.dart:760:54)
<asynchronous suspension>
#5      Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:140:52)
#6      Doctor.diagnose (package:flutter_tools/src/doctor.dart:211:41)
#7      _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#8      Doctor.diagnose (package:flutter_tools/src/doctor.dart:201:24)
#9      _doctorText.<anonymous closure> (package:flutter_tools/runner.dart:202:26)
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:29)
#11     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:7)
#13     _rootRun (dart:async/zone.dart:1124:13)
#14     _CustomZone.run (dart:async/zone.dart:1021:19)
#15     _runZoned (dart:async/zone.dart:1516:10)
#16     runZoned (dart:async/zone.dart:1463:12)
#17     AppContext.run (package:flutter_tools/src/base/context.dart:153:18)
#18     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#19     AppContext.run (package:flutter_tools/src/base/context.dart:140:19)
#20     _doctorText (package:flutter_tools/runner.dart:201:19)
#21     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#22     _doctorText (package:flutter_tools/runner.dart:197:27)
#23     _createLocalCrashReport (package:flutter_tools/runner.dart:179:32)
#24     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#25     _createLocalCrashReport (package:flutter_tools/runner.dart:164:37)
#26     _handleToolError (package:flutter_tools/runner.dart:134:33)
#27     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#28     _rootRunUnary (dart:async/zone.dart:1132:38)
#29     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#30     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#31     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#32     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#33     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#34     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#35     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#36     CrashReportSender.sendReport (package:flutter_tools/src/reporting/crash_reporting.dart)
#37     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#38     _rootRunUnary (dart:async/zone.dart:1132:38)
#39     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#40     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#41     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#42     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#43     Future._complete (dart:async/future_impl.dart:512:7)
#44     Stream.fold.<anonymous closure> (dart:async/stream.dart:801:18)
#45     _rootRun (dart:async/zone.dart:1120:38)
#46     _CustomZone.run (dart:async/zone.dart:1021:19)
#47     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#48     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#49     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#50     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#51     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#52     _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#53     _StringAdapterSink.close (dart:convert/string_conversion.dart:249:11)
#54     _Utf8ConversionSink.close (dart:convert/string_conversion.dart:300:20)
#55     _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:80:18)
#56     _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#57     _rootRun (dart:async/zone.dart:1120:38)
#58     _CustomZone.run (dart:async/zone.dart:1021:19)
#59     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#60     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#61     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#62     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#63     _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#64     _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#65     _rootRun (dart:async/zone.dart:1120:38)
#66     _CustomZone.run (dart:async/zone.dart:1021:19)
#67     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#68     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#69     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#70     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#71     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#72     _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#73     _Uint8ListConversionSink.close (dart:_http/http_impl.dart:577:13)
#74     _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:80:18)
#75     _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#76     _rootRun (dart:async/zone.dart:1120:38)
#77     _CustomZone.run (dart:async/zone.dart:1021:19)
#78     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#79     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#80     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#81     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#82     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#83     _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#84     _ByteAdapterSink.close (dart:convert/byte_conversion.dart:62:11)
#85     _FilterSink.close (dart:io/data_transformer.dart:637:11)
#86     _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:80:18)
#87     _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#88     _rootRun (dart:async/zone.dart:1120:38)
#89     _CustomZone.run (dart:async/zone.dart:1021:19)
#90     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#91     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#92     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#93     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#94     _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#95     _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#96     _rootRun (dart:async/zone.dart:1120:38)
#97     _CustomZone.run (dart:async/zone.dart:1021:19)
#98     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#99     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#100    _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#101    _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#102    _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:772:19)
#103    _StreamController._closeUnchecked (dart:async/stream_controller.dart:629:7)
#104    _StreamController.close (dart:async/stream_controller.dart:622:5)
#105    _HttpParser._closeIncoming (dart:_http/http_parser.dart:1037:23)
#106    _HttpParser._doParse (dart:_http/http_parser.dart:752:11)
#107    _HttpParser._parse (dart:_http/http_parser.dart:318:7)
#108    _HttpParser._onData (dart:_http/http_parser.dart:810:5)
#109    _rootRunUnary (dart:async/zone.dart:1132:38)
#110    _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#111    _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#112    _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#113    _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#114    _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:764:19)
#115    _StreamController._add (dart:async/stream_controller.dart:640:7)
#116    _StreamController.add (dart:async/stream_controller.dart:586:5)
#117    _Socket._onData (dart:io-patch/socket_patch.dart:1791:41)
#118    _rootRunUnary (dart:async/zone.dart:1132:38)
#119    _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#120    _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#121    _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#122    _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#123    _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:764:19)
#124    _StreamController._add (dart:async/stream_controller.dart:640:7)
#125    _StreamController.add (dart:async/stream_controller.dart:586:5)
#126    _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:1004:19)
#127    _rootRun (dart:async/zone.dart:1120:38)
#128    _CustomZone.run (dart:async/zone.dart:1021:19)
#129    _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#130    _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#131    _rootRun (dart:async/zone.dart:1124:13)
#132    _CustomZone.run (dart:async/zone.dart:1021:19)
#133    _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#134    Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
#135    _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#136    _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#137    _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

有人遇到过这个错误吗?

编辑:按照本教程一步一步没有解决问题......(https://www.youtube.com/watch?v=jkWPQHLOAEw

已解决:我终于使用了朋友的 Mac。也许也可以使用虚拟机工作。

于 2019-10-22T17:27:33.997 回答