首页 > 解决方案 > 在我错过了颤振应用程序后,有什么办法可以回到我的旧 Xcode

问题描述

我搞砸了我的 Xcode for iOS flutter。它要求至少部署 iOS 10.0 摄像头。我有 8.0,但我按下了黄色产量的修复,然后它更改了给我所有这些错误的代码。

我已经尝试复制和粘贴我的备份 Xcode 并且没有工作。Pods/Development Pods/camera/open311_s/ios/.symlinks/camera/iOS/classes/Cameraplugin.m我错过了Xcode中的这个类。

Xcode 的输出:↳</p>

 /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:651:45: warning: unused variable
    'discoverySession' [-Wunused-variable]
              AVCaptureDeviceDiscoverySession * discoverySession =
              [AVCaptureDeviceDiscoverySession
                                                ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:662:40: warning: unused variable
    'devices' [-Wunused-variable]
              NSArray<AVCaptureDevice *> * devices = discoverySession.devices;
                                           ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:667:51: error: use of undeclared
    identifier 'devices'
            [[NSMutableArray alloc] initWithCapacity: devices.count];
                                                      ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:668:7: warning: collection expression
    type 'AVCaptureDevice *' may not respond to
    'countByEnumeratingWithState:objects:count:'
          for (AVCaptureDevice *device in device) {
          ^                               ~~~~~~
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:693:19: warning: unused variable 'cam'
    [-Wunused-variable]
              FLTCam *cam = [[FLTCam alloc] initWithCameraName:cameraName
                      ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:706:54: error: use of undeclared
    identifier 'cam'
          int64_t textureId = [_registry registerTexture:cam];
                                                         ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:707:17: error: use of undeclared
    identifier 'cam'
          _camera = cam;
                    ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:708:7: error: use of undeclared
    identifier 'cam'
          cam.onFrameAvailable = ^{
          ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:716:38: error: use of undeclared
    identifier 'cam'
          [eventChannel setStreamHandler:cam];
                                         ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:717:7: error: use of undeclared
    identifier 'cam'
          cam.eventChannel = eventChannel;
          ^
    /Users/zuhairhallak/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/camer
    a-0.4.3+2/ios/Classes/CameraPlugin.m:725:8: error: use of undeclared
    identifier 'cam'
          [cam start];
           ^
    4 warnings and 7 errors generated.

我能够很好地运行该应用程序,但现在我无法运行它。如何修复 Flutter 应用程序的 Xcode。

标签: iosiphonexcodeflutter

解决方案


解决方案:

我弄乱了flutter使用其依赖项提供的相机插件类。您可以在 pubspec.yaml 中找到它。我已经删除了相机的依赖,并且应用程序能够运行。那应该可以解决问题。从flutter插件中复制cameraPlugin.m并删除乱码,然后放入新的。

https://github.com/flutter/plugins/blob/master/packages/camera/ios/Classes/CameraPlugin.m#L25


推荐阅读