12

I've added the SPGooglePlacesAutocomplete cocoapod to my project -- and I'm getting a really weird issue. When I try to run my project, Xcode says there's an error in one of the Pod's headers:

SPGooglePlacesAutocompleteQuery.h:65:23: Unknown type name 'CGFloat'

Attempting to adjust anything in that file - such as importing UIKit - results in an error: "The document SPGooglePlacesAutocompleteQuery.h could not be saved. The file doesn’t exist"

What could be making Xcode thing this file is non-existent?

H K
  • 1,215
  • 2
  • 16
  • 29

8 Answers8

12

For what it's worth, in my case the error came up when I was trying to edit a file pointed to by the warning/error pane in Xcode.

Not sure if that's cocoa pod related but I happen to be using pods also.

Basically you get an error, click on it and try to modify the file to fix the error and sometimes, not sure how, Xcode produces this error.

Since Xcode is stuck trying to save the changes to the file, you have to undo any changes you're made to the file in the error browser. Then editing the file by clicking on it in the regular browser instead of the warning/error pane will let you modify the file and save it.

I'm running Xcode 6.1.1 and Cocoapods 0.36.0.rc.1 and this happens when trying to modify a file from a pod added as a development pod (i.e. from a local directory).

Didier Malenfant
  • 729
  • 1
  • 10
  • 25
  • I had the exact issue. Editing a Cocoapod file from the Issue Navigator gave me the "The file doesn't exist" error, but editing from the Project Navigator worked fine. – Drew C Mar 23 '16 at 16:31
  • 3
    I am having this issue for one of my header files, and that file is not in the warning/error pane. I can't even quite Xcode, because every time I try that error message comes up saying it can't save it. Going to Force-Quit my Xcode now... – Erik van der Neut Oct 03 '16 at 10:01
9

I was facing this problem while I was developing objective-c pod and one of the file(say xx.h &.m) in Classes folder was giving this error prompt. I did following approach:

  1. I copied xx(.h&.m) some where else (say Desktop)
  2. Delete xx(.h&.m) completely from classes folder .
  3. Force quit Xcode
  4. Reopen the project
  5. Drag the file xx(.h&.m) . Select 'copy item if needed' and 'target'.

problem solved!

PANKAJ VERMA
  • 3,450
  • 1
  • 16
  • 15
1

I'm running Xcode 7.3 and CocoaPods 1.0.0. and this happens when trying to modify a file from a pod added as a development pod (i.e. from a local directory).

I just pod update again, when pod finished, Xcode will show an alert "The document has previously unsaved changes.", then click "Re-Save". that fix my issue.

ChenYilong
  • 8,543
  • 9
  • 56
  • 84
1

I have face this issue many times. I followed below steps to fixed this.

  1. Select file->Show in Finder
  2. Copy the file and paste it in a different location.
  3. Remove the original file from Xcode by selecting show in finder
  4. Re-add the file that you copied from a destination and drag it into Xcode file pane where it was before.
  5. Clean and run the code.
doctorBroctor
  • 2,018
  • 1
  • 14
  • 17
Kiran K
  • 919
  • 10
  • 17
1

Delete derived data. Force quit Xcode. Open Xcode Done

Godfather
  • 4,040
  • 6
  • 43
  • 70
0

delete the generated pod folder, pod install again. solve my problem

Zgpeace
  • 3,927
  • 33
  • 31
0

For me what worked was restarting the Macbook.

Amr
  • 2,160
  • 1
  • 15
  • 8
0

I also had the same problem , it was when i was moving the file from one group to another . Xcode showed the same pop-up . All i did was copied all the content of the file with to a new file and deleted the old file , then quit and open the Xcode which solved the problem finally .

Vivek
  • 586
  • 6
  • 11