简体   繁体   English

Xcode 10 Storyboard 非常慢,以至于无响应

[英]Xcode 10 Storyboard extremely slow to the point of unresponsive

my Xcode 8.3.3 storyboard is extremely slow almost unresponsive and I don't know what is causing it.我的 Xcode 8.3.3 故事板非常慢,几乎没有响应,我不知道是什么原因造成的。

Tried:尝试:

Deleting xcuserdata and opening Xcode again.删除 xcuserdata 并再次打开 Xcode。

Opening Xcode on a different project.在不同的项目上打开 Xcode。 (It worked fine. It just seems to be this one main.storyboard in this specific project.) (它工作得很好。它似乎只是这个特定项目中的这个 main.storyboard。)

Extracting the main.storyboard file and opening and closing Xcode then putting it back in.提取 main.storyboard 文件并打开和关闭 Xcode,然后将其放回原处。

Restarting my Mac (Late 2016. Refurbished with touch-bar. 16GB memory 512GB storage.)重新启动我的 Mac(2016 年末。翻新触摸条。16GB 内存 512GB 存储。)

Cleaning the project.清理项目。 (CMD+Shift+K) (CMD+Shift+K)

All of these have failed and I'm trying to launch my app next week.所有这些都失败了,我正在尝试下周启动我的应用程序。 If this persists, I won't be able to launch and will get behind my schedule.如果这种情况持续存在,我将无法启动并且会落后于我的日程安排。

When I deleted the xcuserdata, I was able to navigate to another .swift file and it works fine.当我删除 xcuserdata 时,我能够导航到另一个 .swift 文件并且它工作正常。 But when I go into storyboard it slows down to basically 1FPS.但是当我进入故事板时,它会减慢到基本上 1FPS。 (I have a MacBook Pro with 16GB of RAM I don't know why it isn't handling this better.) (我有一台配备 16GB RAM 的 MacBook Pro,我不知道为什么它不能更好地处理这个问题。)

I'm really fed up with this and all the other things I have tried didn't work.我真的受够了这个,我尝试过的所有其他事情都没有奏效。

I found the anwser to my own question for anyone who is having this issue.对于遇到此问题的任何人,我都找到了我自己的问题的答案。

  1. clear your xcuserdata and xcworkspace from your Xcode project by clicking show package contents on your xcodeproj file.通过单击xcodeproj文件上的显示包内容,从 Xcode 项目中清除xcuserdataxcworkspace Move xcuserdata and xcworkspace to the trash.xcuserdataxcworkspace移至垃圾箱。

  2. This allows you to open up your Xcode project again and be able to open storyboard as source code.这允许您再次打开您的 Xcode 项目并能够将故事板作为源代码打开。 It resets the last file you had open.它会重置您打开的最后一个文件。 To do this right-click (or two-finger click on track-pad) on main.storyboard and choose Open as Source Code为此,请在main.storyboard上右键单击(或用两指单击触控板),然后选择“作为源代码打开”

  3. At the top you'll see some code similar or identical to this在顶部,您会看到一些与此类似或相同的代码

<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="OjV-iF-7f7">
<device id="retina5_5" orientation="portrait">
    <adaptation id="fullscreen"/>
</device>
<dependencies>
    <deployment identifier="iOS"/>
    <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
/* delete this here */
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
    <array key="small_pixel.ttf">
        <string>Small-Pixel</string>
    </array>
</customFonts>
<scenes>

Don't panic, you are only looking for one line.不要惊慌,您只是在寻找一行。 No editing needs to be done.无需进行任何编辑。

<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/"  
  1. Once you've found it, delete the entire line from the code.找到后,从代码中删除整行。

You should now be able to open up the main.storyboard file as the normal interface builder by right-clicking (two-finger click on track-pad) and choosing Open as Interface Builder您现在应该可以通过右键单击(在触控板上用两指单击)并选择Open as Interface Builder来打开 main.storyboard 文件作为普通的界面生成器

(01/07/2020) Reports state this still works for the latest version of Xcode. (01/07/2020) 报告指出这仍然适用于最新版本的 Xcode。

I had extremely slow only when editing on xib file in Xcode version 10.1.仅在 Xcode 10.1 版中编辑 xib 文件时,我的速度非常慢。 What worked for me was to disable the Source Control under Xcode/Preferences/Source Control and then I checked "Enable Source Control" again and it fixed it.对我有用的是在 Xcode/Preferences/Source Control 下禁用 Source Control,然后我再次选中“Enable Source Control”并修复它。

我在 xcode 10.1 上遇到了同样的问题,然后我将项目格式从Xcode 8.0 - 兼容Xcode 9.3 - 兼容,并且一切正常。

If your computer has a dual Graphics card, you can install a GFXCardStatus or otherwise switch to an integrated video card.如果您的计算机有双显卡,您可以安装 GFXCardStatus 或切换到集成显卡。 After this manipulation, the storyboard worked very well for me.经过这种操作后,故事板对我来说效果很好。 Good luck!祝你好运!

https://github.com/steveschow/gfxCardStatus/releases/tag/v2.4.4i https://github.com/steveschow/gfxCardStatus/releases/tag/v2.4.4i

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM