programing

Xcode 6은 Swift에서 자동 완성되지 않습니다.

nasanasas 2020. 11. 22. 19:49
반응형

Xcode 6은 Swift에서 자동 완성되지 않습니다.


정확한 이름을 기억할 수없는 다양한 라이브러리를 가져 오려고합니다. 불행히도 Xcode 6 (사용 swift)은 Objective-c를 사용하여 Xcode 5 에서 수행 된 것처럼 자동 완성되지 않습니다 .

예를 들면 :

ALAssetsLibrary
MPMediaPlayer

기타

정확한 프레임 워크 이름을 Google에 입력 한 다음 돌아가서 붙여 넣기를 복사해야합니다.

일반적으로 자동 완성은 매우 제대로 작동하지 않습니다. Xcode 6에서 뭔가 잘못하고 있습니까?

작동하려면 설정에서 플래그를 설정해야합니까?


이 애플 개발자 포럼의 수정 사항이 저에게 효과적입니다. 베타 5 이후 성능 / 자동 완성 문제가 있었는데 이제는 이전 2010 MBP의 xcode 6.1 / Yosemite가 완벽하게 작동합니다.

  1. Xcode를 종료합니다.
  2. 컴퓨터를 다시 시작합니다 (메모리 내 캐시를 지우는 것입니다).  
  3. DerivedData 폴더 (~ / Library / Developer / Xcode / DerivedData)의 내용을 삭제합니다.
  4. [이것이 주요 이동입니다 :] ~ / Library / Caches / com.apple.dt.Xcode를 삭제하십시오.

이제 Xcode를 한 번 더 시작하십시오…


이것은 위에서 올바르게 선택한 답변과 동일하지만 약간 더 쉽게 만들었습니다.

여러 번 수행해야했으며 테스트에서 Mac을 다시 시작하지 않아도됩니다.

1) Xcode 닫기

2) 터미널-> rm -rf ~ / Library / Developer / Xcode / DerivedData / *

3) 터미널-> rm -rf ~ / Library / Caches / com.apple.dt.Xcode

Xcode를 다시 시작하면 정상으로 돌아갑니다.


내 배포 대상이 8.1이면 자동 완성이 항상 작동합니다. 그러나 그렇지 않은 경우 신뢰할 수 없습니다.

여기에 이미지 설명 입력


xCode 속도를 향상시키고 트릭을 재사용하는 가장 쉬운 방법은 별칭을 만들어 필요할 때마다 호출하는 것입니다.

1. 터미널 열기 :
2. 터미널에 입력 (또는 복사 및 붙여 넣기) :
alias xcodeclean="rm -frd ~/Library/Developer/Xcode/DerivedData/* && rm -frd ~/Library/Caches/com.apple.dt.Xcode/*" 3. 마지막 단계는 입력하려면 xcodeclean(기억하십시오 : 다음에 xCode를 청소하려면을 호출하십시오 xcodeclean)


나는 이런 일이 꽤 많이 발생했으며 예, 최신 베타 버전을 사용하고 있는지 확인하는 것이 도움이됩니다. 불행히도 매번 개발자 포털을 통해 최신 버전을 다운로드해야합니다.

또한 신속한 컴파일러가 오류가 없어도 컴파일하는 데 어려움을 겪고있을 때 자동 완성 기능이 사라지고 올바른 코드 줄을 주석 처리하거나 제거하면 기능이 예상대로 돌아 오는 것을 발견했습니다. 확실히 베타 품질 소프트웨어에서 비롯됩니다.

A last week I was beating my head against the wall because the swift compiler wasn't playing nice with the sqrt() function. Hopefully these issues are ironed out by the time of full release.

Sorry there's no real 'fix' yet!


Sometimes it doesn't autocomplete for me either. I think this is due to the fact that Xcode 6 is still in beta. Btw, have you been updating Xcode 6 beta? The latest is beta 5 at the moment. I failed to notice for some time that the App Store does not update Xcode 6 beta, so I was stuck with beta 1 for a while. If you haven't been updating it, then do it. Maybe that will help with bugs like this.


I find this extremely annoying. Posted answer to clear derived data works bulletproof, however you should close xcode before clearing folder. I've made small script to do the work for me.

#!/bin/bash

echo "Start fixing xCode"
echo "Closing xCode"
osascript -e 'tell app "Xcode" to quit'
sleep 2
echo "Clearing DerivedData..."
rm -rf "$HOME/Library/Developer/Xcode/DerivedData"
sleep 2
echo "Launch xCode again"
osascript -e 'tell app "Xcode" to run'
echo "Finish fixing xCode"

Now whenever xCode gives me a finger I simply run it. The problem that you need to recompile everything however still persists.

EDIT

Thanks to on suggestion in the comments from @Nikolay Spassov, I adjusted the script to capture your home directory instead of changing it. So below step is no longer neccessary.

OLD Step

Please note you have to change '/Users/iphonedev5...' part to make it work in your system :)


I tried changing the Fonts & Color to default and it worked. I normally have it on MidNight2.


I tried all of these, but to no avail - nothing worked. My situation is I have a Swift class "A" that after performing a large merge into my branch could no longer see several other Swift files ("B" - "F") that were located in a different Group from within my project.

What's interesting is "A" belongs to both the main project Target, but also to the UnitTest Target whereas "B", "C", "D", "E", and "F" ONLY belonged to the main project Target.

By including them for membership with the UnitTests also all of a sudden Xcode can now see those classes correctly - must be members in the same Targets, perhaps?

The fixed a couple of things: 1) Code completion now works. 2) The little red error markers that are next to the line numbers ("unresolved identifier" errors) cleared up too. This last one was very annoying to me as when you CMD-B to build they clear up and the code compiles just fine / runs just fine. But, make ANY change (add a single white space, for example) and these reappeared all the time (and, of course, Code Completion would stop working again as well).

Not sure if this is a Swift or Xcode issue but this is what fixed it for me.


If you can't locate all the folders mentioned above or you are too lazy to type in the terminal try the following below:

•Create a new folder on desktop

•Go to your application folder copy the Xcode application

•Paste the application in the folder you created on the desktop

* 응용 프로그램 폴더로 다시 돌아가서 응용 프로그램 폴더에서 Xcode를 삭제하십시오. cleanMyMac2 또는 다른 클리너 앱을 사용하여 Xcode 앱을 삭제할 수 있으므로 com.apple.Xcode 및 기타 파일과 같은 모든 파일이 이동합니다.

• 컴퓨터를 다시 시작한 후

• 초기에 만든 폴더로 이동하여 Xcode를 열면 이용 약관이 표시되고 프로젝트를 수락하고 시작합니다.

행운을 빕니다

참고 URL : https://stackoverflow.com/questions/25133039/xcode-6-isnt-autocompleting-in-swift

반응형