Xamarin iOS-找不到图片

问题描述 投票:0回答:1

Visual Studio 2019-WindowsXamarin Forms v4.60800

编译我的iOS项目时出现以下错误

严重级别描述项目文件行抑制状态错误System.IO.FileNotFoundException:找不到文件

"/Users/.../Library/Caches/Xamarin/mtbs/builds/xxx.Mobile.iOS/b97b05343d52097d681db173220d856c/obj/iPhoneSimulator/Debug/optimized/LogoWithTitleRight.png"
File name: '/Users/.../Library/Caches/Xamarin/mtbs/builds/xxx.Mobile.iOS/b97b05343d52097d681db173220d856c/obj/iPhoneSimulator/Debug/optimized/LogoWithTitleRight.png'
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:106 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
  at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x00025] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:54 
  at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00056] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:74 
  at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile (System.String source, System.String target, System.String targetItemSpec) [0x0002d] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/SmartCopyTaskBase.cs:67 
  at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute () [0x000a4] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/SmartCopyTaskBase.cs:100 xxx.Mobile.iOS  

但是,资源文件夹中的LogoWithTitleRight.png图像

最初我的图像是作为链接添加的,但是现在它实际上在那儿。

这是针对少数图像而并非全部发生的(如果我删除了对该图像的所有引用,那么它将在下一个图像上失败,等等)

我已经清理了解决方案,关闭了Visual Studio,从iOS和PCL项目中删除了obj / bin文件夹。但是我仍然遇到相同的错误。

任何想法?

xamarin xamarin.ios
1个回答
0
投票

这是我修复它(为他人使用的方法。)>]

我在GIMP(穷人用的Photoshop)中打开了有问题的图片。选择了整个图像。复制它。然后粘贴为新图像。然后保存该PNG。

编译了我的解决方案。现在,它在另一张图像上给出了相同的错误。再次对该图像和其他3个图像进行了处理,现在一切正常。

Android始终可以很好地处理图像。

© www.soinside.com 2019 - 2024. All rights reserved.