Xcode 7 Err “Editor placeholder in source code”

2019-06-16 12:26发布

I have just started trying to learn Swift, but one error keeps cropping up time and again and I can not find out why - "Editor placeholder in source code". What could be causing this (I am unable to post a picture of the code as I am a new member).

Thanks

7条回答
混吃等死
2楼-- · 2019-06-16 12:30

For me it helped to fix this (my code is correct) just applying Xcode - Product - Clean (Shift+Cmd+K)

查看更多
放我归山
3楼-- · 2019-06-16 12:38

I've had this issue while doing a Udemy Course that didn't update the curricula with the new Swift 3 info. At least that's what I'm guessing caused the issue that kep on giving me this error.

Old broken code:

let cell = UITableViewCell(style: UITableViewCellStyle, reuseIdentifier: "Cell")

New, working code

let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "Cell")
查看更多
我只想做你的唯一
4楼-- · 2019-06-16 12:40

I had the same problem, it was caused by a double space (Xcode 8.1 beta)

before:

let cell = UITableViewCell(style:  UITableViewCellStyle.default, reuseIdentifier: "Cell")

after (working!):

let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "Cell")

(the 2 spaces are after "style:")

查看更多
▲ chillily
5楼-- · 2019-06-16 12:42

It happened to me just now, but the reason was pretty straightforward once I looked at the code. I was using the autofill class as the param for a function. Ergot "place holder"

//Leaving the auto-completed signature gave the error
myclass.myFunction(myParam: UIControl)

//removing the auto complete params and using a real one cleared error
myclass.myFunction(myUIControl)
查看更多
对你真心纯属浪费
6楼-- · 2019-06-16 12:52

Just happened to me using xcode 7.3.1 on existing code "that was fine yesterday". I couldn't see anything wrong, so I re-typed (the offending line to see where it went wrong) on the line above and deleted the original and error went away. A git diff shows no change.

查看更多
该账号已被封号
7楼-- · 2019-06-16 12:56

It's happened to me, but I had forgot to define a part of code:

When I get the error:

let cell = tableView.dequeueReusableCellWithIdentifier("EmployeeTableViewCell",
    forIndexPath: NSIndexPath) as! EmployeeTableViewCell

After I fixed:

let cell = tableView.dequeueReusableCellWithIdentifier("EmployeeTableViewCell",
    forIndexPath: indexPath) as! EmployeeTableViewCell
查看更多
登录 后发表回答