IOS 项目在 xcode 7.1 上显示错误“发生内部错误。编辑功能可能受到限制”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33456411/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IOS project showing error "An internal error occurred. Editing functionality may be limited" on xcode 7.1
提问by Arjun T Raj
I just created one new cordova ios project via CLI, and i opened that project in Xcode 7.1 and while running on simulator am getting some error on mainViewController.xib, if we clicked on that error its showing xib file and on top of that showing one warning message "An internal error occurred. Editing functionality may be limited" . So am unable to run this project.
我刚刚通过 CLI 创建了一个新的 cordova ios 项目,我在 Xcode 7.1 中打开了该项目,在模拟器上运行时在 mainViewController.xib 上出现了一些错误,如果我们点击该错误,它会显示 xib 文件并在显示一个文件的顶部警告消息“发生内部错误。编辑功能可能受到限制”。所以我无法运行这个项目。
I don't know whether this is due to Xcode bug or cordova bug or any other settings issue in my Xcode.
我不知道这是由于 Xcode 错误还是cordova 错误或我的 Xcode 中的任何其他设置问题。
回答by jithin
I had this issue and clearing derived data folder fixed the issue for me
我遇到了这个问题,清除派生数据文件夹为我解决了这个问题
Preferences > Locations > Derived Data > click the arrow to open in Finder > trash it.
回答by Jaywant Khedkar
Try this, it's work for me,
试试这个,它对我有用,
Updated NOTE: Mostly this error occurred when you have open 2 different version of Xcodeat same time.
更新注意:大多数情况下,当您同时打开 2 个不同版本的Xcode时会发生此错误。
Solution: Please close both Xcode and clear derived data.now again try, use one Xcode at a time.
解决方案:请关闭两个 Xcode 并清除派生数据。现在再试一次,一次使用一个 Xcode。
OR
或者
Follow below mention steps,
按照下面提到的步骤,
1) Trash derived data by two ways either by command or Preferences.
1) 通过命令或首选项通过两种方式删除派生数据。
rm -rf ~/Library/Developer/Xcode/DerivedData/
OR
或者
Xcode---> Preferences--->Location--->Derived Data
2) In Xcodemenu go to product clearthe project.
2) 在Xcode菜单中转到产品清除项目。
3) Disconnect connected device and restart Xcodeand system.
3) 断开连接的设备并重新启动Xcode和系统。
follow above steps error will remove.
按照上述步骤错误将消除。
Hope it's helpful for some one.
希望对某人有帮助。
回答by Ryan Cocuzzo
Fixed the problem in my program, hope this can help someone!
修复了我程序中的问题,希望这可以帮助某人!
So, this is the process of my fix:
所以,这是我修复的过程:
Could not figure out why I was getting this issue, when everything had been working fine.
I tried the following:
Cleaning project
DeletingDerivedData
Creating new, identical View Controllers to see if the issue was just in those particular views. (the same issue occurred)
Deleting and Reinstalling Xcode
Restarting my Computer.
Asking on StackOverflow.
(Finally) Submitting a TSI, which got redirected to Apple Bug Reporter.I made a new swift file for the View Controller that was having the issue, and it compiled, showing that is was not an issue with the View Controller itself.
I started getting an error: "Command failed due to signal: Segmentation fault: 11" (on the file associated with the View that did not work), which is really ambiguous. This error looks as if it would be an error occurring in a segue (jumping from one View Controller to another) but the code itself would not compile. After digging into the error, I realized the code stopped compiling at that swift file.
So, I copy-pasted the code from the swift file (the one causing problems) into the Notes application and I deleted the swift file from the Application.
Little by little, I started taking code from the file that did not work (in Notes) and putting it into the file that did work until the error came up:
Command failed due to signal: Segmentation fault: 11
I started commenting out snippets of the code to isolate the error.
After finding the error line, I realized it was just an error that caused all of these issues. A simple fix that the debugger did not recognize as a routine error. So, I fixed it and it works!
当一切正常时,无法弄清楚为什么我会遇到这个问题。
我尝试了以下操作:
Cleaning project
DeletingDerivedData
创建新的、相同的视图控制器以查看问题是否仅出现在这些特定视图中。(发生了同样的问题)
删除并重新安装 Xcode
重新启动我的电脑。
在 StackOverflow 上询问。
(最后)提交一个 TSI,它被重定向到 Apple Bug Reporter。我为有问题的视图控制器创建了一个新的 swift 文件,并进行了编译,表明这不是视图控制器本身的问题。
我开始收到一个错误:“由于信号导致命令失败:分段错误:11”(在与无效的视图关联的文件上),这真的很模棱两可。此错误看起来好像是在 segue 中发生的错误(从一个 View Controller 跳转到另一个),但代码本身无法编译。在深入研究错误后,我意识到代码停止在该 swift 文件中编译。
因此,我将 swift 文件(导致问题的那个)中的代码复制粘贴到 Notes 应用程序中,然后从应用程序中删除了 swift 文件。
一点一点地,我开始从无效的文件(在 Notes 中)提取代码并将其放入有效的文件中,直到出现错误:
由于信号导致命令失败:分段错误:11
我开始注释掉代码片段以隔离错误。
找到错误行后,我意识到这只是导致所有这些问题的错误。调试器未识别为常规错误的简单修复。所以,我修复了它并且它有效!
And for those of you less inclined to read
对于那些不太愿意阅读的人
Summary of what your problem may be:
您可能遇到的问题的摘要:
- Compile-time error in your code that is not recognized by the Xcode debugger!
- Xcode 调试器无法识别您的代码中的编译时错误!
回答by ZiggyST
I'm in Xcode 7.3 and had the same issue after opening file in xCode 8.0. This worked for me:
我在 Xcode 7.3 中,在 xCode 8.0 中打开文件后遇到了同样的问题。这对我有用:
Made a product/clean in Xcode, then quit Xcode and clean out all the content in ~/Library/Developer/Xcode/DerivedData manually.
在 Xcode 中创建一个 product/clean,然后退出 Xcode 并手动清除 ~/Library/Developer/Xcode/DerivedData 中的所有内容。
回答by Chris Ho
Close project from File menu and Reopen the project again, the issue is gone.
从文件菜单关闭项目并再次重新打开项目,问题消失了。
回答by Alfi
Mine caused from creating a bad constraint so I fixed the constraint and everything is working now.
我的原因是创建了一个不好的约束,所以我修复了约束,现在一切正常。
回答by Stephen Johnson
I was getting this error on Xcode 11.4. I tried all of the above suggestions and none of them worked. I am posting my fix in case it will help someone else. I was using the legacy build system for my project since I had options that were not yet supported with the latest build system. Xcode 11.4 now supports those options. I the value for BuildSystemType
to Latest
in all of WorkspaceSettings.xcsettings files and then this error went away.
我在 Xcode 11.4 上收到此错误。我尝试了上述所有建议,但都没有奏效。我正在发布我的修复程序,以防它对其他人有所帮助。我在我的项目中使用旧版构建系统,因为我有最新构建系统尚不支持的选项。Xcode 11.4 现在支持这些选项。我在所有 WorkspaceSettings.xcsettings 文件中设置了BuildSystemType
to的值Latest
,然后这个错误就消失了。
<key>BuildSystemType</key>
<string>Latest</string>
回答by Hristo Atanasov
Yesterday I had this problem too. I remember I've had it before 1 year too and I remember how to fix it. The reason for the error (in my case) was an error in the code in AppDelegate. Sometimes errors in AppDelegate are the reason for this behaviour of xCode. So if You want to fix it, first try commenting Your code in AppDelegate function by function, until you find the function with the error. Once you find it start uncommenting piece by piece the code in that particular function until you see which code line is breaking everything. Believe me ... This will save you lots of time searching the internet.
昨天我也遇到了这个问题。我记得我在 1 年前也有过它,我记得如何修复它。错误的原因(就我而言)是 AppDelegate 中的代码错误。有时 AppDelegate 中的错误是 xCode 出现这种行为的原因。因此,如果您想修复它,请首先尝试在 AppDelegate 函数中逐个注释您的代码,直到找到有错误的函数。一旦你发现它开始逐段取消该特定函数中的代码的注释,直到你看到哪一行代码破坏了所有内容。相信我......这将节省您在互联网上搜索的大量时间。
回答by Alex Ureche
Xcode 7.3.1
Xcode 7.3.1
In my case, the error was caused by the following line:
就我而言,错误是由以下行引起的:
print("|" + board[x][y])
Changed to:
变成:
print("| \(board[x][y])")
After that, I did a Product -> Clean (Command+Shift+K) That fixed the issue.
之后,我做了一个 Product -> Clean (Command+Shift+K) 解决了这个问题。
PS:board[x][y] is a [[Character]], if that matters. I copy-pasted my Java Class into Xcode to edit it into Swift.
PS:board[x][y] 是一个 [[Character]],如果这很重要的话。我将我的 Java 类复制粘贴到 Xcode 中以将其编辑到 Swift 中。
回答by Caroline Foreman
I have the same problem. The only way I have found to get round this is to update the target 'Deployment Target' to 8.1 and also the CordovaLib project 'Deployment Target' to 8.1 this allows the app to build and run without the MainViewController error. However this is not a great solution as I assume it no longer supports devices with ios 7.1 installed.
我也有同样的问题。我发现解决此问题的唯一方法是将目标“部署目标”更新为 8.1,并将 CordovaLib 项目“部署目标”更新为 8.1,这允许应用程序构建和运行而不会出现 MainViewController 错误。然而,这不是一个很好的解决方案,因为我认为它不再支持安装了 ios 7.1 的设备。