After changing file locations, project can't recognize some of my classes - ios

First off, I know this is a config issue because my code was building and running just fine before I synced my project to GitHub. Xcode's internal source control seems to be having trouble recognizing some of my files and I'm getting Use of unresolved identifier... errors where these files' initializers are in use, and were working before. I'm running the latest versions of Xcode and OS X, and these are the steps I was taking before and after the issue started...
BEFORE:
After several rounds of implementation and committing with the default local repository, I built and ran the app multiple times with no issues.
I created a new repository on GitHub, committed (w/push to remotes) and everything made it to GitHub just fine and was building and running in the simulator.
In order to organize the repository (to match the 'groups' I had created in Xcode) I did some brief research and then added nested directories to my project folder. I re-opened Xcode and repaired the file paths. Some took, but several kept showing ? (although I could still access the code just fine) and I got the corresponding Missing Files... warnings.
Because I couldn't get the new hierarchy to work (the files w/?s, not being recognized, were not able to be committed to GitHub), I tried to move the files back. This worked for most, but for a few (which seem to be the effected files) I had to rename them, recreate a new file and then paste their contents over (this is where I think the problem lies). I was able to commit everything to GitHub (even the problem files went up) but all the warnings remained.
To clear out the warnings I attempted to run my tests, and that's when the Use of unresolved identifier... errors popped up, and of course the build failed.
AFTER:
I verified all the paths and target memberships were correct.
When that didn't work, I built an entirely new project (although I did add it to the same workspace; not sure if that matters) and copy/pasted all my code over to new files. I didn't drag / reference the files and I didn't link the new project to GitHub. When I went to build, same errors in the same places...
I exited the workspace and opened the new project separately. Still no joy.
Any help or points in the right direction would be much appreciated.
EDIT:
After some help, I tried deleting the reference and dragging the file in manually but that didn't resolve the issue.
I also checked Build Phases -> Compile Sources and everything was listed fine with no compiler flags. I removed and re-added from Compile Sources, issue persists.

You can try removing referencer for the missing class file in Xcode,then add same file to folder (right click add file ) from physical workspace location this might help.

After rebuilding an entirely new app a third time, with all new files, I copied the files over and this time everything seems to be working fine. Had to repair a bunch of provisioning issues to make sure it worked (maybe that was part of the problem, but I doubt it), but everything is back to normal with the app. The only thing I did differently this time was not adding the new project to the same workspace.

Related

Deleted class drops error message unknown>:0: error: no such file or directory:

So me and some friends working on a bitbucket project and already realized that bitbucket sometimes doesn't sync all the files. But here is what happened:
I continued working and created an class, I basically copied an old View Controller (called WelcomescreenViewController.swift -> CreateAccountViewController.swift) and made some adjustments in the main storyboard. Here I deleted all the old outlets in the new one and then made an own class for it as ViewController and connected it with it in the main storyboard.
What now happened is that there were some problems and I reverted everything and deleted both things again. And basically now Xcode still kind of thinks that there should be the class. It always drops the message:
I also made a screenshot from the directory with my files as it is now:
I tried to create the class again, so that Xcode is happy but it doesn't help. Is the file somewhere linked or what shall I do, to teach Xcode hey everything is fine, don't mind about the old file CreateAccountViewController.swift?
Make sure in your target settings, under Build Phases > Compile Sources that your file isn't listed there:
Also, just check it somehow hasn't been added to Copy Bundle Resources.
If you're developing a pod, and the deleted file is in the pod, try pod install to rebuild the framework.
Check if the deleted files are still in Project, if yes, delete. build ...

‘Cloud/CLAPIEngine.h’ file not found

My application has been running fine with the Cloud-iOS.a library for the past few days. However, today, when I used the “Product > Clear Build Folder” command and tried to run the app again, it would give me this error:
‘Cloud/CLAPIEngine.h’ file not found
The Cloud library builds successfully, but the main project gives me that error along with 4 others in both the main project and the XCTest files (that are linked with this one).
I’ve tried removing and re-inserting the file from Build Phases > Headers and Build Phases > Compile Sources and that didn’t do anything (I also have tried to remove the -fno-objc-arc flag from the file to see if it would recognize it, and sure enough, it gave me an ARC error). I’ve tried looking through other SO questions like these:
Restkit/Restkit.h file not found Xcode 6.1
Adding frameworks to project in Xcode 5 and having *relative* paths added
... and nothing worked. I even tried restarting the app itself and nothing happened. I made a test project and included the same library to see if it’s my project, but this project also says the same errors. Both projects also have the file in the "include/" directory. I don’t know why this is happening and I’m starting to get really tired with Xcode’s random problems.
I’ve included the test project in a Dropbox link for others to check out and see why it’s doing this.
https://www.dropbox.com/sh/lu8hntaaww8y6r4/AAA1KJ085YvKjwMR-AZff6Nga?dl=0
What can I do to get this to run again? Thanks in advance.
(After this, I’m not running the “Clear Build Folder" command again.)
Ok. Looks like someone over at Apple Developer Forums was able to give me an answer. I chose the last one that they gave me, which was to change the static library into a framework. Thank goodness Apple made this available on iOS, because (after a bit of tweaking), everything works!

Fix duplicate working copies in Xcode with SVN

I have an Xcode project I am working on with several other people. Everything has been going fine until recently source control (SVN) has shown up with two working copies on my computer. One of them is the actually project (what I want) but the other one has become the Asset Catalog somehow. How do I fix this?
Check in all your changes, and try to clean up working copy if still it doesn't work delete the working copy and check fresh repo code.

Xamarin.Android build error: duplicate class R.java

I loaded a long-dormant Xamarin.Android project that I last opened in MonoDevelop, when it was still called Mono for Android. Every time I tried to build the project, debug or release, it fails with "Error: duplicate class" pointing to R.java.
Since R.java is just an auto-generated file for the various project resources, I tried editing a filename and letting Xamarin Studio update the file. This didn't resolve the build error.
Similar searches find issues with improperly named IDs in an axml file, but all the IDs in this project appear to meet Android requirements (and it built fine the last time I worked on it to generate the project's APK).
Deleting the project's bin and obj folders entirely and letting them be rebuilt from scratch resolved the build error just fine.
Since the actual R.java file is buried deep in the obj folder, it may have been possible to be a little less eager with the deletes. There is probably a better solution entirely, but this certainly got the job done.
delete all files and folders from your c:\users\\appdata\local\xamarin\
Restart VS - very important
Clean Solution
Build / Rebuild solution
If the above ends up with some other resource errors , close and reopen VS and repeat steps 2,3,4.

Xcode weird random error that doesn't go away

I have a regular project i'm working on for a while -
I've edited the plist file, which caused some problem, so i've reverted to the old plist file (where all used to work), but the following errors always show and dont go away,
I've tried cleaning the project (Cmd+Shift+k , Cmd+Opt+Shift+k) , Tried resetting my pbjprox, tried clearing ~/Library/Developer/Xcode/DerivedData/ and /var/folders
Nothing works, and i guess the errors are cached somewhere that i can't think of...
Would appreciate your hints about this
Shai
This is easy to fix - your files are not on location where Xcode expects them. Just delete the file from your project and add it again.
If this doesn't work, it can be a collision with your versioning system - see Missing file warnings showing up after upgrade to XCode 4
I would copy these files into another location (outside the project folder) and then remove them from the project and add them back (Add Files to ...). Make sure to select Copy Items into destinations group's folder
Sounds like Xcode is a little confused about the association of these files to your project.

Resources