Programing

인덱싱에서 Xcode가 멈춤

crosscheck 2020. 8. 11. 07:52
반응형

인덱싱에서 Xcode가 멈춤


내가 2 개월 동안 작업해온 프로젝트는 Xcode가 "인덱싱"에 갇혀서 아무런 이유없이 작동을 멈췄습니다. 더 이상 프로젝트를 빌드 할 수 없습니다. 빌드하려고하면 Xcode가 멈추고 강제 종료해야합니다. 이것은이 프로젝트에서만 발생합니다.

모든 파생 데이터를 정리하려고했지만 도움이되지 않았습니다.

Xcode 4.5.2를 사용하고 있습니다.

어떤 아이디어?


  1. 프로젝트 폴더를 엽니 다.
  2. ProjectName.xcodeproj 파일을 찾습니다.
  3. 안전한 장소에 복사 및 붙여 넣기를 마우스 오른쪽 버튼으로 클릭합니다.
  4. 패키지 내용 표시를 마우스 오른쪽 버튼으로 클릭합니다.
  5. project.xcworkspace 파일을 찾아 삭제하십시오.
  6. 프로젝트를 다시 열고 정리하고 다시 빌드하십시오.

문제가 해결되지 않으면 파일을 백업 파일로 교체하십시오.


  1. Xcode에서 해당 프로젝트를 닫습니다.
  2. Xcode Organizer를 열고 문제가있는 프로젝트 찾기
  3. 오거나이저에서 파생 데이터 폴더 삭제
  4. Xcode 닫기 / 다시 열기

파생 데이터 Nuking은 Xcode가 오작동하는 모든 경우에 가장 먼저 시도하는 것입니다.


나는이 정확한 문제가 있었는데, 그것은 20 항목 배열 리터럴로 인해 발생했습니다. 다른 구문으로 전환해야했습니다. 꽤 어리 석다.


  1. 열려있는 모든 Xcode를 닫습니다.
  2. rm -rf ~/Library/Developer/Xcode/DerivedData
  3. PROJECT_NAME.xcworkspace를 마우스 오른쪽 버튼으로 클릭하고 '콘텐츠 표시'를 선택한 다음 'xcuserdata'폴더를 삭제합니다.

Xcode 6을 사용할 때

만들기를 기다리는 중

make의 인스턴스가 이미 실행 중일 수 있습니다. 프로세스를 종료하고 인덱싱이 진행됩니다. 바보 같지만 나를 위해 일했습니다.


비슷한 문제가 있었고 실수로 클래스를 자체 하위 클래스로 정의했음을 발견했습니다. 이것에 대한 경고 나 오류가 없지만 컴파일이 중단되었습니다.

class mainClass : mainClass
{
    ...
}

Alt> 제품> 빌드 폴더 정리


나를 위해 Xcode를 완전히 닫은 다음 프로젝트를 다시 시작했습니다.

이것은 원래 질문에 대한 해결책이 아니라고 믿지 않지만 파일과 폴더 등을 삭제하기 전에 시도하는 것이 하나 더 간단 합니다. 아이디어에 대한 이 답변에 대한 크레딧 입니다.


이것은 Xcode 버그 (Xcode 8.2.1)이며 Apple에보고했습니다. 큰 사전 리터럴이나 중첩 된 사전 리터럴이있을 때 발생합니다. 사전을 더 작은 부분으로 나누고 Apple이 버그를 수정할 때까지 추가 방법으로 추가해야합니다.


Xcode가 많은 시간을 인덱싱하고 프로젝트 빌드를 자주 중단하는 비슷한 문제가 발생했습니다.이 시점에서 강제 종료하고 Xcode를 다시 시작해야했습니다. 매우 성가신 일이었습니다.

그런 다음 프로젝트에서 부적절하게 self대리인으로 지정되었다는 경고를 발견했습니다 . 물론 클래스 선언에 누락 된 프로토콜이있었습니다. OP의 샘플 코드에는 유사한 할당이 있습니다 (샘플에서 올바른 프로토콜이 선언되었는지 여부를 알 수는 없지만).

leaderboardController.leaderboardDelegate == self;

(구현 된 프로토콜을 올바르게 선언하여) 경고를 해결 한 후 Xcode는 오작동을 중지했습니다. 또한 프로토콜 메서드 구현 되었기 때문에 프로젝트가 올바르게 실행 되었습니다 . 단지 Xcode가 프로토콜이 실제로 클래스에 의해 구현되어야한다는 것을 확인할 수 없었습니다 .


  • 먼저 네트워크 연결을 끊습니다. 유선 네트워크와 무선 네트워크가 모두 꺼져 야합니다.
  • 둘째, com.apple.dt.SourceKitService프로세스를 종료하십시오. 그런 다음 XCode는 멈춤 대신 다시 색인을 생성하기 시작합니다.

여기에 이미지 설명 입력


인덱싱 문제를 해결하려는 경우 시도해야 할 또 다른 방법은 페이지 아래에 있습니다.

빌드 설정에이 플래그를 추가해보세요.

-Xfrontend -warn-long-expression-type-checking=400

빌드 설정 플래그

컴파일러가 복잡한 표현식을 추론하는 데 오랜 시간이 걸리는 경우 경고가 발생합니다.

경고

이로 인해 느린 표현식을 찾은 다음 빌드 플래그를 제거한 후 사라지는 빌드 오류가 발생할 수 있습니다.


Had similar problem in Xcode 6.4. The progress bar indicated that "Indexing" was "Paused". Tried deleting project.xcworkspace, then deleting Derived Data as described above. Did not appear to help. Noting that the posts above also suggest fixing warnings, and since I had inherited this huge project with 180 warnings, I said to myself, "What the hell this looks like a good day to fix warnings". As I was fixing warnings, a half hour later, I noticed that the "Indexing" progress bar had increased from 10% to about 20%. An hour later, it was at 50%, then another hour to 80%, then after another half hour it was done! Conclusion: Add "take a long lunch or a nap" to the above suggestions.


I experienced the same issue for Xcode 7.0 beta. In my case, values for "Provisioning Profile" and "Product bundle identifier" of "Build Settings" differed between PROJECT and TARGETS. I set the same values for them. And I also used the same values for TARGETS of "appName" and "appNameTest". Then closed the project and reopened it. That resolved my case.


In my case, deleting the derived data directory did not help. Apparently I had a file locked by another process, because after closing out a couple of terminal windows and emacs, and terminating a react-native packager process, everything resolved.


For me, I made a stupid mistake. I write a Class like this:

class A: A {
.......
}

A class inherit itself that causes the freezing. There is no message hint from Xcode.


This happened to me. If you are using cocoapods do this:

  1. Delete project.xcworkspace
  2. Reinstall pods using 'pod install' on the terminal
  3. It will create a new project.xcworkspace
  4. Open the new project.xcworkspace -> Clean -> Build

I have experienced this problem in some projects with Xcode 9.3.1 and in my case the problem is due to some swift code that for some reason Xcode doesn't like. This problem is hard to solve because is difficult to find what file is causing the problem.

When I have this problem, I removing some files from the Xcode project (removing references) and I try to test if indexing works. My process to do so

  1. Remove some files
  2. Close Xcode
  3. Open Xcode
  4. If indexing finish try to rename some method if works probably the files you have removed they have something strange for Xcode.

In my case I had a class definition with a reactive extension in the same file and for some reason Xcode doesn't like it, I moved the reactive extension to another file and now the indexing works fine.


Nothing worked for me, my project is too big (merging objective c, c++, swift, and java files with j2obj). I've disabled Xcode indexing and worked without code completion for months (and it's a pain). But finally I've found a workaround. The idea is to keep Xcode indexing the code, but to limit its CPU usage with an external tool like cputhrottle.

So first you need to install cputhrottle in terminal

brew install cputhrottle

Then limit the Xcode indexing process like this (20 = 20%)

sudo cputhrottle $(pgrep -f com.apple.dt.SKAgent) 20

I've exposed my "solution" here with mode details : How to prevent Xcode using 100% of CPU when indexing big projects


Also stop running app. if you have another application running with your xcode, stop it first and you should have your indexing continue.


For me, the cause was I opened the same file in both the Primary Editor and Assistant Editor at the same time. Once I closed Assistant Editor, it came through. (Xcode Version 7.2.1)


Close Your Xcode , close any git client(source tree or terminal)if it is opened and finally restart your project.


I too was facing the problem. I noticed that I have opened the same project twice.

So QuitXCode > Open your project and make sure only one instance is open > Clean > CleanBuild Folder in some cases > build.

It should work


Faced this recently on XCode 7.3.1 - for me, I noticed RAM usage going to 100% on to CleanMyMac3. The problem magically fixed itself after I restarted my machine. In all fairness however, I'd already gone ahead and tried the accepted-answer, so you'll want to do the same before you restart just in case :-)


I fixed this by simply deleting the app from my device and rebuild.


I had the same issue in swift 2.2

It had to do with a generic function overloaded function

func warnLog() {
    print("Warning line: \(#line) file: \(#file) ")
}

func warnLog<T>(input:T? = nil) -> T? {
    print("Warning line: \(#line) file: \(#file) ")
    return input
}

func warnLog<T>(input:T) -> T {
    print("Warning line: \(#line) file: \(#file) ")
    return input
}

all I needed to do is remove one of the non used overloads

func warnLog<T>(input:T? = nil) -> T? {
    print("Warning line: \(#line) file: \(#file) ")
    return input
}

My case: it was not the project.xcworkspace file, it was not the Derived Data folder.

I've wasted a lot of time. Worse, no error message. No clue on the part of Xcode. Absolutely lost.

Finally this function (with more than 10 parameters) is responsible.

func animationFrames(level: Float,
                     image: String,
                     frame0: String,
                     frame1: String,
                     frame2: String,
                     frame3: String,
                     frame4: String,
                     frame5: String,
                     frame6: String,
                     frame7: String,
                     frame8: String,
                     frame9: String,
                     frame10: String) {
}

To go crazy! The truth is that it is worrisome (because there is no syntax error, or any type)


For XCode 9.3 indexing issue - Uninstall the XCode and instal again from zero. Works for me.


This issue happened to me when my machine was out of swap space. Closed several programs and browser tabs and the build suddenly succeeded after 30 minutes of being stuck in place. Nothing to do with derived data, locked files, etc. on my side.


나열된 모든 것을 시도했지만 인덱싱이 계속 중단됩니다. 이것은 나를 도왔습니다 : 만약 당신의 인덱싱이 멈추고 당신의 CPU의 99 %를 먹는 하나 이상의 신속한 프로세스가 있다면-이 빠른 작업을 죽이고 조금만 기다리면 진행이 진행될 것입니다. 완료 될 때까지 반복 할 수 있습니다. 제 경우에는 프로세스를 7 번 죽 였지만 결국 인덱싱이 완료되었습니다!

참고 URL : https://stackoverflow.com/questions/13831559/xcode-stuck-on-indexing

반응형