如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?

时间:2023-01-12 20:07:01

Xcode 6 GM now includes simulators for iPhone 6 and 6 Plus, and by default they run apps in a scaled mode.

Xcode 6 GM现在包括了iPhone 6和6 Plus的模拟器,默认情况下,它们会按比例模式运行应用程序。

To enable the new screen size I tried adding Default-667h@2x.png which seems to do a part of the trick since the app now fails to run at all, with the error "Unable to run app in Simulator – An error was encountered while running (Domain = LaunchServicesError, Code = 0)".

为了启用新的屏幕大小,我尝试添加Default-667h@2x。png似乎是这个技巧的一部分,因为应用程序现在根本无法运行,错误是“无法在模拟器中运行应用程序—运行时遇到错误(Domain = LaunchServicesError, Code = 0)”。

Has anyone figured out how to get an app actually run in the 6/6+ resolution?

有人知道如何让应用程序在6/6+分辨率下运行吗?

8 个解决方案

#1


216  

You can add a launch screen file that appears to work for multiple screen sizes. I just added the MainStoryboard as a launch screen file and that stopped the app from scaling. I think I will need to add a permanent launch screen later, but that got the native resolution up and working quickly. In Xcode, go to your target, general and add the launch screen file there.

您可以添加一个启动屏幕文件,该文件可以用于多个屏幕大小。我只是添加了MainStoryboard作为启动屏幕文件,这阻止了应用程序的缩放。我想稍后我将需要添加一个永久的发射屏幕,但这已经提高了本机的分辨率并快速工作。在Xcode中,转到目标,general并在那里添加启动屏幕文件。

如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?

#2


117  

If you are using asset catalogs, go to the LaunchImages asset catalog and add the new launch images for the two new iPhones. You may need to right-click and choose "Add New Launch Image" to see a place to add the new images.

如果您正在使用资产目录,请访问LaunchImages资产目录,并为这两款新iphone添加新的启动映像。您可能需要右键单击并选择“添加新启动映像”以查看添加新映像的位置。

The iPhone 6 (Retina HD 4.7) requires a portrait launch image of 750 x 1334.

iPhone 6(视网膜HD 4.7)需要750 x 1334的人像启动图像。

The iPhone 6 Plus (Retina HD 5.5) requires both portrait and landscape images sized as 1242 x 2208 and 2208 x 1242 respectively.

iPhone 6 Plus (Retina HD 5.5)需要分别为1242 x 2208和2208 x 1242的人像和景观图像。

#3


104  

I've made basic black launch screens that will make the app scale properly on the iPhone 6 and iPhone 6+:

我已经制作了基本的黑色启动屏幕,可以让应用在iPhone 6和iPhone 6+上正常扩展:

iPhone 6 Portrait

iPhone 6肖像

iPhone 6 Plus Portrait

iPhone 6 +肖像

If you already have a LaunchImage in your .xcassett, open it, switch to the third tab in the right menu in Xcode and tick the iOS 8.0 iPhone images to add them to the existing set. Then drag the images over:

如果您的.xcassett中已经有一个LaunchImage,请打开它,切换到Xcode中右边菜单中的第三个选项卡,勾选iOS 8.0 iPhone images添加到现有的设置中。

如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?

#4


52  

I didn't want to introduce an asset catalog.

我不想引入资产目录。

Per the answer from seahorseseaeo here, adding the following to info.plist worked for me. (I edited it as a "source code".) I then named the images Default-667h@2x.png and Default-736h@3x.png

根据海星的答案,在这里添加以下信息。plist为我工作。(我把它编辑为“源代码”。)然后我将这些图像命名为Default-667h@2x。png和默认- 736 h@3x.png

<key>UILaunchImages</key>
<array>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-667h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{375, 667}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-736h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{414, 736}</string>
    </dict>
</array>

#5


21  

Note that iPhone 6 will use the 320pt (640px) resolution if you have enabled the 'Display Zoom' in iPhone > Settings > Display & Brightness > View.

请注意,如果你在iPhone >设置>显示和亮度>视图中启用了“显示缩放”,iPhone 6将使用320pt (640px)分辨率。

#6


8  

Do the following (see in photo)

执行以下操作(见图)

  1. Goto asset catalog
  2. 转到资产目录
  3. right-click and choose "Add New Launch Image"

    右击并选择“添加新启动映像”

    • iPhone 6 -> 750 x 1334
    • iPhone 6 -> 750 x 1334
    • iPhone 6 Plus -> 1242 x 2208 and 2208 x 1242
    • iPhone 6 Plus -> 1242 x 2208和2208 x 1242

如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?

#7


3  

An error was encountered while running (Domain = LaunchServicesError, Code = 0)

运行时遇到错误(Domain = LaunchServicesError, Code = 0)

Usually this indicates that installd returned an error during the install process (bad resources or similar).

通常这表明installd在安装过程中返回一个错误(错误的资源或类似的资源)。

Unfortunately, Xcode does not display the actual underlying error (feel free to file dupes of this known bug).

不幸的是,Xcode没有显示实际的底层错误(请随意对这个已知错误进行文件欺骗)。

You should check ~/Library/Logs/CoreSimulator/CoreSimulator.log which will log the underlying error for you.

您应该检查~ /图书馆/日志/ CoreSimulator / CoreSimulator。为您记录潜在错误的日志。

#8


0  

If you are using asset catalog, and have multiple targets both using same asset catalog file, be sure that this file has checked both targets in the right panel in xcode.

如果您正在使用资产目录,并且有多个目标同时使用相同的资产目录文件,请确保该文件在xcode的右侧面板中检查了这两个目标。

That was my problem.

这是我的问题。

如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?

#1


216  

You can add a launch screen file that appears to work for multiple screen sizes. I just added the MainStoryboard as a launch screen file and that stopped the app from scaling. I think I will need to add a permanent launch screen later, but that got the native resolution up and working quickly. In Xcode, go to your target, general and add the launch screen file there.

您可以添加一个启动屏幕文件,该文件可以用于多个屏幕大小。我只是添加了MainStoryboard作为启动屏幕文件,这阻止了应用程序的缩放。我想稍后我将需要添加一个永久的发射屏幕,但这已经提高了本机的分辨率并快速工作。在Xcode中,转到目标,general并在那里添加启动屏幕文件。

如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?

#2


117  

If you are using asset catalogs, go to the LaunchImages asset catalog and add the new launch images for the two new iPhones. You may need to right-click and choose "Add New Launch Image" to see a place to add the new images.

如果您正在使用资产目录,请访问LaunchImages资产目录,并为这两款新iphone添加新的启动映像。您可能需要右键单击并选择“添加新启动映像”以查看添加新映像的位置。

The iPhone 6 (Retina HD 4.7) requires a portrait launch image of 750 x 1334.

iPhone 6(视网膜HD 4.7)需要750 x 1334的人像启动图像。

The iPhone 6 Plus (Retina HD 5.5) requires both portrait and landscape images sized as 1242 x 2208 and 2208 x 1242 respectively.

iPhone 6 Plus (Retina HD 5.5)需要分别为1242 x 2208和2208 x 1242的人像和景观图像。

#3


104  

I've made basic black launch screens that will make the app scale properly on the iPhone 6 and iPhone 6+:

我已经制作了基本的黑色启动屏幕,可以让应用在iPhone 6和iPhone 6+上正常扩展:

iPhone 6 Portrait

iPhone 6肖像

iPhone 6 Plus Portrait

iPhone 6 +肖像

If you already have a LaunchImage in your .xcassett, open it, switch to the third tab in the right menu in Xcode and tick the iOS 8.0 iPhone images to add them to the existing set. Then drag the images over:

如果您的.xcassett中已经有一个LaunchImage,请打开它,切换到Xcode中右边菜单中的第三个选项卡,勾选iOS 8.0 iPhone images添加到现有的设置中。

如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?

#4


52  

I didn't want to introduce an asset catalog.

我不想引入资产目录。

Per the answer from seahorseseaeo here, adding the following to info.plist worked for me. (I edited it as a "source code".) I then named the images Default-667h@2x.png and Default-736h@3x.png

根据海星的答案,在这里添加以下信息。plist为我工作。(我把它编辑为“源代码”。)然后我将这些图像命名为Default-667h@2x。png和默认- 736 h@3x.png

<key>UILaunchImages</key>
<array>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-667h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{375, 667}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-736h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{414, 736}</string>
    </dict>
</array>

#5


21  

Note that iPhone 6 will use the 320pt (640px) resolution if you have enabled the 'Display Zoom' in iPhone > Settings > Display & Brightness > View.

请注意,如果你在iPhone >设置>显示和亮度>视图中启用了“显示缩放”,iPhone 6将使用320pt (640px)分辨率。

#6


8  

Do the following (see in photo)

执行以下操作(见图)

  1. Goto asset catalog
  2. 转到资产目录
  3. right-click and choose "Add New Launch Image"

    右击并选择“添加新启动映像”

    • iPhone 6 -> 750 x 1334
    • iPhone 6 -> 750 x 1334
    • iPhone 6 Plus -> 1242 x 2208 and 2208 x 1242
    • iPhone 6 Plus -> 1242 x 2208和2208 x 1242

如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?

#7


3  

An error was encountered while running (Domain = LaunchServicesError, Code = 0)

运行时遇到错误(Domain = LaunchServicesError, Code = 0)

Usually this indicates that installd returned an error during the install process (bad resources or similar).

通常这表明installd在安装过程中返回一个错误(错误的资源或类似的资源)。

Unfortunately, Xcode does not display the actual underlying error (feel free to file dupes of this known bug).

不幸的是,Xcode没有显示实际的底层错误(请随意对这个已知错误进行文件欺骗)。

You should check ~/Library/Logs/CoreSimulator/CoreSimulator.log which will log the underlying error for you.

您应该检查~ /图书馆/日志/ CoreSimulator / CoreSimulator。为您记录潜在错误的日志。

#8


0  

If you are using asset catalog, and have multiple targets both using same asset catalog file, be sure that this file has checked both targets in the right panel in xcode.

如果您正在使用资产目录,并且有多个目标同时使用相同的资产目录文件,请确保该文件在xcode的右侧面板中检查了这两个目标。

That was my problem.

这是我的问题。

如何为iPhone 6和6 Plus上的应用程序启用本地分辨率?