flutter项目运行报错"variable 'originRect' is used"

Running pod install...                                              1.5s
Running Xcode build...                                                  
Xcode build done.                                            4.9s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:33:11: warning: variable
    'originRect' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
          if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:40:26: note: uninitialized
    use occurs here
                    atSource:originRect];
                             ^~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:33:7: note: remove the 'if'
    if its condition is always true
          if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:33:11: warning: variable
    'originRect' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
          if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:40:26: note: uninitialized
    use occurs here
                    atSource:originRect];
                             ^~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:33:11: note: remove the '&&'
    if its condition is always true
          if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:33:11: warning: variable
    'originRect' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
          if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:40:26: note: uninitialized
    use occurs here
                    atSource:originRect];
                             ^~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:33:11: note: remove the '&&'
    if its condition is always true
          if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:33:11: warning: variable
    'originRect' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
          if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
              ^~~~~~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:40:26: note: uninitialized
    use occurs here
                    atSource:originRect];
                             ^~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:33:11: note: remove the '&&'
    if its condition is always true
          if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
              ^~~~~~~~~~~~~~~~~
    /Users/leo/Code/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.5.3/ios/Classes/SharePlugin.m:32:7: note: variable
    'originRect' is declared here
          CGRect originRect;
          ^
    4 warnings generated.

    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment
    target versions is 9.0 to 14.3.99. (in target 'url_launcher' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment
    target versions is 9.0 to 14.3.99. (in target 'shared_preferences' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment
    target versions is 9.0 to 14.3.99. (in target 'share' from project 'Pods')
    warning: None of the architectures in ARCHS (x86_64) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to
    include at least one value from VALID_ARCHS (arm64, arm64e, armv7, armv7s). (in target 'Runner' from project 'Runner')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment
    target versions is 9.0 to 14.3.99. (in target 'Flutter' from project 'Pods')

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

运行的项目是:
https://github.com/2d-inc/His...

ide: vscode
device: ios 模拟器

新手学flutter,不知道怎么解决。。

阅读 2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题