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

发布于 2022-09-12 13:50:28 字数 6153 浏览 17 评论 0

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,不知道怎么解决。。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文