.NET MAUI无法替换默认紫色MauiIcon与MauiSplashScreen求助
.NET MAUI iOS 应用图标与启动页不更新问题求助
我已将新的.svg图片添加到AppIcon和Splash目录,并将这些文件的Build Action设置为MauiIcon和MauiSplashScreen,但未生效。随后发现.csproj文件中已存在相关引用:
<ItemGroup> <!-- App Icon --> <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\bridgerecordicon.svg" Color="#512BD4" /> <!-- Splash Screen --> <MauiSplashScreen Include="Resources\Splash\bridgerecordsplash.svg" Color="#512BD4" BaseSize="128,128" /> </ItemGroup>
以上两种操作均无明显效果。
根据微软文档说明:
在iOS上,启动画面会作为名为MauiSplash.storyboard的故事板添加到应用包中,并在Info.plist的UILaunchStoryboardName键中设置其值:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> ... <key>UILaunchStoryboardName</key> <string>MauiSplash</string> ... </dict> </plist>因此,不应在Info.plist中设置UILaunchStoryboardName键,也不应向应用添加LaunchScreen.storyboard。
我检查了MauiSplash.storyboard文件,它似乎已引用更新后的启动图片:
<?xml version="1.0" encoding="UTF-8"?> <!--This file was auto-generated by .NET MAUI.--> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--View Controller--> <scene sceneID="EHf-IW-A2E"> <objects> <viewController id="01J-lp-oVM" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/> <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="bridgerecordsplash.png" translatesAutoresizingMaskIntoConstraints="NO" id="aT4-1l-d9a"> <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> </imageView> </subviews> <color key="backgroundColor" red="0.3176471" green="0.1686275" blue="0.8313726" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </view> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="53" y="375"/> </scene> </scenes> <resources> <image name="{0}" /> </resources> </document>
但Info.plist文件中并未包含文档指定的条目:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>LSRequiresIPhoneOS</key> <true/> <key>UIDeviceFamily</key> <array> <integer>1</integer> <integer>2</integer> </array> <key>UIRequiredDeviceCapabilities</key> <array> <string>arm64</string> </array> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>XSAppIconAssets</key> <string>Assets.xcassets/appicon.appiconset</string> </dict> </plist>
我手动添加了该条目进行测试,但仍无帮助。此外我还参考了相关问题,替换了相关文件,看似已重新关联,但仍无可见效果。恳请各位提供解决思路。
内容的提问来源于stack exchange,提问作者Mark
相关产品推荐
相关产品推荐

