为什么 iOS 模拟器在实际启动画面出现前会出现白屏
Why is there a white screen before the actual launch screen appears in iOS simulator
我创建了一个 flutter 应用程序,然后使用故事板添加了一个带有 XCode 的启动屏幕。我的启动屏幕包含一个与底部对齐的背景图像和一个居中的徽标。现在每次我启动应用程序时,在实际启动屏幕出现之前都会有一个白屏。这是我的 LaunchScreen.storyboard:
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<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="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</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 opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" insetsLayoutMarginsFromSafeArea="NO" image="LaunchImage.Background" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
<rect key="frame" x="0.0" y="84" width="414" height="812"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchImage.Center" translatesAutoresizingMaskIntoConstraints="NO" id="m2E-Yf-1dK">
<rect key="frame" x="79" y="431" width="256" height="34"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="4X2-HB-R7a"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="7gX-RD-p4w"/>
<constraint firstAttribute="trailing" secondItem="YRO-k0-Ey4" secondAttribute="trailing" id="SGD-Ee-rA9"/>
<constraint firstItem="m2E-Yf-1dK" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="Uz2-O6-cFf"/>
<constraint firstItem="m2E-Yf-1dK" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="f3e-ab-K73"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="76.811594202898561" y="251.11607142857142"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage.Background" width="375" height="812"/>
<image name="LaunchImage.Center" width="256" height="34"/>
</resources>
</document>
我试图弄清楚为什么在实际启动屏幕之前显示此白屏,并且我尝试了其他 Whosebug 问题中建议的许多方法,但无济于事。现在我一点头绪都没有。
我自己解决了这个问题,原来是缓存问题。有
flutter clean
并在 iOS 模拟器上擦除设备设置和内容,白屏消失。
** 您的 IP 地址可能会自动更新 - 因此请确保您 运行 npm run serve
时的 IP 地址与 capcitor.config.json
中的 IP 地址相匹配
我创建了一个 flutter 应用程序,然后使用故事板添加了一个带有 XCode 的启动屏幕。我的启动屏幕包含一个与底部对齐的背景图像和一个居中的徽标。现在每次我启动应用程序时,在实际启动屏幕出现之前都会有一个白屏。这是我的 LaunchScreen.storyboard:
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<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="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</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 opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" insetsLayoutMarginsFromSafeArea="NO" image="LaunchImage.Background" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
<rect key="frame" x="0.0" y="84" width="414" height="812"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchImage.Center" translatesAutoresizingMaskIntoConstraints="NO" id="m2E-Yf-1dK">
<rect key="frame" x="79" y="431" width="256" height="34"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="4X2-HB-R7a"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="7gX-RD-p4w"/>
<constraint firstAttribute="trailing" secondItem="YRO-k0-Ey4" secondAttribute="trailing" id="SGD-Ee-rA9"/>
<constraint firstItem="m2E-Yf-1dK" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="Uz2-O6-cFf"/>
<constraint firstItem="m2E-Yf-1dK" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="f3e-ab-K73"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="76.811594202898561" y="251.11607142857142"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage.Background" width="375" height="812"/>
<image name="LaunchImage.Center" width="256" height="34"/>
</resources>
</document>
我试图弄清楚为什么在实际启动屏幕之前显示此白屏,并且我尝试了其他 Whosebug 问题中建议的许多方法,但无济于事。现在我一点头绪都没有。
我自己解决了这个问题,原来是缓存问题。有
flutter clean
并在 iOS 模拟器上擦除设备设置和内容,白屏消失。
** 您的 IP 地址可能会自动更新 - 因此请确保您 运行 npm run serve
时的 IP 地址与 capcitor.config.json