Cannot open Xcode project on a new Mac - ios

I think I have made a bit of a mistake here.
I designed an app a few months ago and even got it in the App Store. Since then I have purchased a new mac. I copied my Xcode project file across to my new Mac.
I've just come back to it for the first time in months and nothing opens. I sometimes get a cannot be parsed warning. Even looking at the file sizes I think there are all just empty files. When I try and open them in TextEdit they are just empty.
Any ideas anyone, I have a particular .swift file that I really need to open.

Check if the files are empty on your old Mac. If they are empty on your old Mac then the data has been lost, there is nothing you can do.
If the files are correct on your old Mac then something went wrong when you transferred the data. Therefore just try copying them over again.
If the first situation that I stated is true then there is nothing you can do.

Can you not retrieve the original files from your other Mac?
copy and paste
Would imply that you can. Maybe you should attempt to copy the files again, alternatively, if you just need the one .swift file you could probably copy the text from it and put it into plaintext and then copy that back out into a new xcode project if xcode is having such trouble opening that particular file.
Are you sure that you're not missing out some details? Seems almost too easy to answer this one.

Related

Transferring Xcode Project from one computer to another brings random errors?

I have a Xcode project I got from another developer. Initially when I opened it it has a bunch of errors (most of which were un-updated frameworks). I got it to work after a while and I fixed it. I want pass it back to the manager since I'm leaving uni in a few months. I copied it over to my friends Mac to see what would happen if I just took the project and all it's folders and made it a zipfile. It didn't work for some reason. It gave me an error:
error: using bridging headers with framework targets is unsupported
But why did that come up? I mean it's the same code on the slightly different versions of Xcode (13.1 versos 14.1) but I doubt there was a massive change between the two that would cause this. I want to be able to pass these app later in the future without having to care about this stuff. I made a GitHub (link below) would cloning that work? Also the laptop I chose was just a fresh reset. Would it be due to not having coco-pods installed?
I feel like I could go through and fix it all on that laptop and document that but then I'm afraid that every time I put it on a new one it would come up with random errors every single time making my documentation moot.
https://github.com/AbdullahMSaid/SonicExperiment-Works
With big help this was Fixed.
Things that fixed it.
Having the correct version of Xcode
Turning everything from absolute path to relative
Lots of other code fixes. But those are my project specific.
You don't need bridging headers in framework. Use should have something like "YourFramework.h" where you can import your .h files.

Xcode project not opening in Xcode 8 - cannot be parsed [duplicate]

I think I have made a bit of a mistake here.
I designed an app a few months ago and even got it in the App Store. Since then I have purchased a new mac. I copied my Xcode project file across to my new Mac.
I've just come back to it for the first time in months and nothing opens. I sometimes get a cannot be parsed warning. Even looking at the file sizes I think there are all just empty files. When I try and open them in TextEdit they are just empty.
Any ideas anyone, I have a particular .swift file that I really need to open.
Check if the files are empty on your old Mac. If they are empty on your old Mac then the data has been lost, there is nothing you can do.
If the files are correct on your old Mac then something went wrong when you transferred the data. Therefore just try copying them over again.
If the first situation that I stated is true then there is nothing you can do.
Can you not retrieve the original files from your other Mac?
copy and paste
Would imply that you can. Maybe you should attempt to copy the files again, alternatively, if you just need the one .swift file you could probably copy the text from it and put it into plaintext and then copy that back out into a new xcode project if xcode is having such trouble opening that particular file.
Are you sure that you're not missing out some details? Seems almost too easy to answer this one.

Xcode crashed while renaming project - whole project broken

I wanted to release an app I worked on and quickly change the project name. I usually duplicate projects before doing things like this but this time - because this procedure always worked on Xcode as I found it way more reliable than e.g. Eclipse - I didn't, which I immediately regretted.
Opened Xcode again and now I am seeing this
I guess all the linking is gone now which is why Xcode doesn't "find" the files anymore. Renaming the remaining project stem to the old name gives
couldn’t be moved to because an item with the
same name already exists
and also manual renaming of folders won't work as the .xcodeproj is gone.
The project is written in Objective-C, and all the classes are still persistent, but the effort of adding all the xib's, referencing the outlets, setting architectures, etc will become the nightmare of my life. I do have a half-way recent backup but everything I did to make the app store-ready today will be gone.
Any ideas on how to rescue my project?
EDIT: What Xcode is now showing on the welcome screen is a project called "project" (literally) and it has the usual compass icon but with a white instead of a blue background referring to the path <project folder>/<new project name>/ and below that "white" project there is a folder icon with the new name pointing to <project folder>.
I also made a snapshot before, of course it now says "Unable to read snapshots" in the "restore from snapshots" window.
Ok what I now did is renaming ALL references from the old project name to the new one. I even changed file names. I used Xcode's CMD+SHIFT+F and TextWrangler's "replace" function and thankfully I still had the .xcodeproj from yesterday's backup so from there I could copy it into the new project and rename stuff. There are still some things that don't work perfectly, for example auto layout doesn't "stretch" contents over the screen (it stays on iPhone 4s size, even on 6 plus simulator), I needed to set the scheme again and Launch Images / Icons got lost but I can look over that. The only thing I am afraid of now is that the final build might miss out a symbol or something like that so I eventually have a corrupt file in the App Store, but man it's a beta version, how much worse can it get anyway?
Thanks to everyone recommending me to even backup the broken project, I did this even before you said it but because I think it's a valuable advice I wanted to put it in my answer as well.
It's a shame that stuff like this can happen, I've been backing up my work on a daily basis and my project never got corrupted - until now.

Xcode stalls on "loading" when trying to create new project

Xcode 6 never gets past "Loading" when I try to create a new project. I actually was able to create a new project yesterday, but I decided to just ditch it completely (deleted). Clearly there must be a bad file somewhere, possibly related to the project I deleted, since I also see the same stalling behavior now with Xcode 5.1, which has worked fine for creating new projects in the past. Xcode 6 has worked fine when starting with an already existing project and still appears to do so. I did not see this exact problem in your data base, though one person saw the project creation freeze before reaching the stage I get to. Their solution was to delete Xcode and every possible file related to it, which I'm a little squeamish about, since I don't want to affect existing projects, and don't have an understanding of what the various files are for.
Deleting the DerivedData of Xcode should fix the issue. You can do this by heading to ~/Library/Developer/XCode/DerivedData (with a Finder window open press cmd+G) and deleting all the subfolders of it.
This is embarrassing, but if it could happen to me, maybe it could happen to someone else. The problem was that the window that came up after the second step in defining the type of project to be created, the one in which you choose where to save the project's files, extended off the bottom of the screen, so that only the very tops of the buttons were visible. Eventually, I realized the one to the far right might be the one to click to continue. Which it was. Feel free to delete this question.

NSLocalizedString returns text that is defined nowhere

OK, I am officially flabbergasted. I started an IOS project some time ago, and juggled around with localization a bit at the start, which became a bit of a mess, because I did not know how to do that properly yet.
Now I have decided to do the localization from scratch, and therefore threw away all the .strings files, and created a proper multi-language structure. I started with empty Localizable.strings files, and run the app to see whether I cleaned up everything properly. With empty Localizable.string files, I assumed my "NSLocalizedString" calls would simply return the key as text. They don't. They still return the old text that I had in the old .strings files.
Just to be sure, I put an NSLog statement under one of the NSLocalizedString calls, as such:
NSString *text = NSLocalizedString( key, nil );
NSLog(#"key=%# text=%#", key, text);
Then I search my whole harddisk for the text that was returned. No file on my harddisk contains the string that NSLocalizedString returns. And it is a completely different string than the key, so it cannot be constructed by NSLocalizedString either.
Anybody knows how this can happen? Is the old info cached somewhere by XCode? How can I persuade the tool to use the new Localizable.strings files? Obviously, I have already 'clean'ed and rebuilt the whole project.
Try to delete the app from the phone, then clean your project and install the app afresh.
If it still doesn't work, check you haven't somehow messed up with the Build Rules (Xcode 4 -> select your target -> tab "Build Rules") There, check if you don't have too many "CopyStringsFile" rules that aren't using "CopyStringsFile". If so you can remove them all but one.
If you are testing on the simulator, try resetting the simulator using the "Reset content and settings..." option in the "iOS Simulator" application menu.
When you redeploy a new build of the app, even after a clean build, it often doesn't clear out the cached content of the previously built version.
Did you also clean build folder? command + option + shift + k or go to product, press option, there will be a clean build folder, usually, resources file are cached, any resources file replacement (file with same file name but different object) might not be detected by XCode
Also, deleting app / resetting simulator does help. Deleted files sometime don't get removed when you redeploy.

Resources