IOS 项目显示错误“一个内部错误发生。编辑功能可能是有限的”在 xcode 7.1上

我刚刚通过 CLI 创建了一个新的 cordova ios 项目,我在 Xcode 7.1中打开了这个项目,当在模拟器上运行时,在 mainViewController.xib 上出现了一些错误,如果我们点击这个错误,它会显示 xib 文件,在这个错误上面显示一条警告消息“发生了一个内部错误。编辑功能可能有限”。所以我无法运行这个项目。

我不知道这是否是由于 Xcode bug 或 cordova bug 或者我的 Xcode 中的任何其他设置问题。

enter image description here

46193 次浏览

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.

I have deleted XCode 7.1 and installed XCode 7.0.1.

http://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.0.1/Xcode_7.0.1.dmg

This solved the problem.

I updated XCode to 7.1.1 and this resolved the issue.

I changed Xcode - Preferences - Text Editing, ticked on 'Code Folding Ribbon' and 'Focus code blocks on hover'.

Cleaned the project and it removed the source editing error.

I'm in Xcode 7.3 and had the same issue after opening file in xCode 8.0. This worked for me:

Made a product/clean in Xcode, then quit Xcode and clean out all the content in ~/Library/Developer/Xcode/DerivedData manually.

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.

Close project from File menu and Reopen the project again, the issue is gone.

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.

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.

PS: board[x][y] is a [[Character]], if that matters. I copy-pasted my Java Class into Xcode to edit it into Swift.

Try this, it's work for me,

Updated NOTE: Mostly this error occurred when you have open 2 different version of Xcode at same time.

Solution: Please close both Xcode and clear derived data.now again try, use one Xcode at a time.

OR

Follow below mention steps ,

1) Trash derived data by two ways either by command or Preferences.

rm -rf ~/Library/Developer/Xcode/DerivedData/

OR

Xcode---> Preferences--->Location--->Derived Data

derived data

2) In Xcode menu go to product clear the project.

enter image description here

3) Disconnect connected device and restart Xcode and system .

enter image description here

follow above steps error will remove.

Hope it's helpful for some one.

Fixed the problem in my program, hope this can help someone!

So, this is the process of my fix:

  1. Could not figure out why I was getting this issue, when everything had been working fine.

  2. I tried the following:
    Cleaning project
    Deleting DerivedData
    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.

  3. 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.

  4. 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.

  5. 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.

  6. 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

  7. I started commenting out snippets of the code to isolate the error.

  8. 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!

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!

Running Xcode 7.3.1, I had the same error message appear while editing a .xib file. Performance would stall, and Xcode often became unresponsive. Filed a bug report, and in the meantime came across this line of code in the .m file associated with the most problematic .xib:

NSString *check = [formatter stringFromDate:date];/

The "/" was not being flagged as an error, and the project had built and run many times with this in place. After removing the "/", performance improved dramatically, and the error message has only appeared a couple of times, briefly, since then and by now not for several days.

So far, this seems to be a case of a glitch in the debugger.

As for me problem was in ternary operator (single line if statement). Version 7.3.1

FWIW, here's what fixed this for me:

I was performing an operation on a value in a dictionary:

_outcomes[key] *= multiplier

I didn't realize that Swift would treat the value as an optional even though the dictionary is not an optional in this class.

changing to the following worked:

_outcomes[key]! *= multiplier

I just had this issue today and it really got me frustrated for awhile. First I got the error "unable to boot the simulator" and I couldn't load the simulator and then my storyboard started doing this and I got an internal error.

I tried the other solutions mentioned here including cleaning and rebuilding, deleting the DerivedData folder but none worked. I upgraded my OS to Sierra and that solved the problem for me.

Hope it helps.

This has been happening to me on Swift 3.1, Xcode 8.3.2 for a month, I was coding okay, But it came to a point that all the text was only plain text, no colours, no auto complete, no indent. What a torture.....

Xcode was showing an error for NSAttributedString, but it was compiling fine, I could even see the underlined button in the app no problem. When I removed this code xcode went back to normal. How strange.

Took me days to figure out. I checked out every single commit from github until I found a version of my project that doesnt throw An internal error occurred. Source editor functionality is limited. error.

Then I compared the commit versions and I figured this started to happen when I edited UIButton text thru the code.

Error caused because of NSAttributedString I wanted to underline to the button text as following

    let titleAttributes:[String : Any] = [NSForegroundColorAttributeName : Constants.forgotPassColor, NSUnderlineStyleAttributeName : NSUnderlineStyle.styleSingle.rawValue]
let localizedForgotPass = NSLocalizedString("forgotPassword", tableName: "Localizable", comment: "forgot button text")
let titleString = NSAttributedString(string: localizedForgotPass, attributes: titleAttributes)
forgetPasswordButton.setAttributedTitle(titleString, for: .normal)

Removing this solved the problem. There is something wrong with NSAttributedString in Swift 3.1

Unfortunately, this error is pretty generic and doesn't point to an actual cause. If you look at the error report generated by Xcode, you might be able to get more context to figure out what is going on.

Common causes include:

  • Incorrect permissions / ownership set on files.
  • Manually deleting files in ~/Library/Developer.
  • Installing buggy 3rd party kexts (especially security or firewall software).

from my side, its RAM issue. I have remove others application.Then it works normally.

This happened to me in Xcode 10.2, while editing .xib file. Trying to clear de derived data didn't help me. What solved the problem was change the device for prototyping in the interface builder, it forced the IB to render again and solved the problem. enter image description here

Mine caused from creating a bad constraint so I fixed the constraint and everything is working now.

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.

    <key>BuildSystemType</key>
<string>Latest</string>

Also happens when you declare non-swift/wrong data types like Long, boolean etc. So stupid.

Super specific but one of compile-time errors that can cause this is putting the keyword 'optional' before a function in a non-objc protocol.

It happened to me because I copied buttons from old XIB files to the storyboard. So i deleted the buttons, and all is ok. I am guessing apple added some non compatible button XMLs in the new storyboard.

I had this problem yesterday, and after some digging, I solved the problem which was very stupid in my case. I discovered that I put an environment object inside a class function, like this:

class SomeHelpers {
static func someFunc(_ value: Bool) {
@EnvironmentObject var userData: UserData // << HERE
}
}

I removed that line, and the strange error gone away.

I solved this problem on XCode 13.4 by disconnecting the device (iPhone) and restarting XCode. Before that I tried to clean Derived Data and Build Folder - didn't help.

Just to add to the mix. This started to happen to me out of sudden with Xcode 14.0. There was also "Report a bug" button on the top-right. Clicking on the button created a folder with the bug report and in the log.txt file there there was a reference to IBAgent failure and iPhone SE simulator - the one used for the preview in the interface builder.

Looks like the IBAgent process crashed at some earlier point. I had no idea how to restart this particular process. Cleaning derived data folder & restarting Xcode were not helping.

The whole mac restart fixed the issue. IBAgent is running and opening that same storyboard with no problem.

Reported/Submitted to Apple.