Xcode's default projects folder missing - xcode8

I'm quite new in iOS development and right now I'm watching tutorial videos. In them I see that every time a new project is created, Xcode suggests /home/Xcode as root destination where you can store your project. This folder has even a special icon with the Xcode logo on it.
On my Mac this folder is missing. I still can save the project elsewhere but even after re-installing Xcode that folder is missing.
Any idea how I can fix that?

The /home/Xcode folder is not the default location to store Xcode projects. The home folder is hidden by default on macOS so I suggest choosing a different folder to store your projects.
It does not matter where you save your Xcode projects. Save them wherever you want on your computer.

Related

Can't Add ReactNativeNavigation.xcodeproj to Libraries in Xcode

I can't add the ReactNativeNavigation.xcodeproj file to my projects Libraries. Any ideas on how to get around this? I left click on Libraries then click add files to my project then go into node_module → react-native-navigation → iOS but then I can't click on the Xcode.proj is like a disabled button when I click on it.
I'm using Xcode 9.4.1.
Screenshot:
Solution:
Some how (probably my doing) the ReactNativeNavigation was added to the main project folder so I dragged it down to where the Libraries folder was, and the problem was solved. I suggest if you have this issue to search all the folder in your project, because it is probably already added somewhere in the project.
I discovered ReactNativeNavigation was added to the main project folder so I dragged it down to where the Libraries folder was, and the problem was solved. I suggest if you have this issue to search all the folder in your project, because it is probably already added somewhere in the project.

Xcode 9: How do I re-associate a project with a workspace?

I am working on a workspace that contains my project and my CocoaPods. I keep the whole thing on iCloud and work on it from my desktop and laptop. Everything has been working fine until recently when the workspace shows my project files on my desktop but not on my laptop. All of the pods appear on both devices.
Importantly, all of the project files are still there on my laptop and continue to sync perfectly with my desktop over iCloud:
I know this problem was caused by using iCloud for syncing. The question is how do I re-associate the project with the workspace on my laptop so I can continue to work on my app from both devices.
I figured it out. It seemed risky at first but it worked. I am posting the solution here in case someone else has the same dilemma. Back up everything before you attempt.
On the laptop, in the navigator pane, I clicked on '+' and selected
'add files to ...'. Then I selected my project file within the
project folder and added it. This added the project back to my
laptop, but I ended up with 2 copies of the project on my desktop
computer associated with one workspace.
On the desktop computer, I deleted one of the projects and sent it
to trash. Both copies of the project disappeared in the project
navigator.
On the desktop computer, I opened my trash and dragged the project
file back into the project folder. The project then showed up in
the navigation pane.
Everything is now working perfectly on both computers and I can continue to use iCloud to work on my app from either device.

iOS simulator only uses the first app folder for localStorage files but creates a new app folder for everything else

I'm trying to delete the localStorage files of my app, and to do that I need to know where the app stores its cached data, but I don't consistently get the correct path in the iOS simulator, this only works consistently on the phone.
I think this has something to do with the fact that Xcode renames the app directory when you rebuild. If I delete the entire /Users/john_doe/Library/Developer/CoreSimulator/Devices/ and start the app NSSearchPathForDirectoriesInDomains finds the correct folder. On the next build the path that is returned is the new application directory, but the iOS simulator still uses the localStorage files in the old folder.
The code I run in Xcode to find the caches path: NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomainMask.UserDomainMask, true).last as! String
tl;dr iOS simulator gives you a new application folder every time you stop and rebuild the app, but it uses the application folder from the first build for writing and reading the localStorage files.
Anybody have a workaround? A bug on this with Apple?

Can't remove today view extension from iOS

I tried to remove an iOS8 today view extension from my iOS App in Xcode6, but somehow the extension is still built and always appearing on the device. I removed both the extensions files from the project as well as the build target. I also removed the application multiple times but the widget is still always copied whenever I build the application.
If you want to keep the sourcecode and only remove the today widget:
go to your app target into your project file
select General -> Embedded binaries
remove the TodayWidgetName.appex file with the minus button
do a clean
If you compile or archive you should not see any longer the today widget appearing in the iOS notification center.
I finally found a solution: in the menu go to Product > Clean and the extensions that are not used or built anymore are gone!
Apparently, there is a way of removing embedded binaries from compiled IPA package if you don't want to recompile. Obviously, after altering the package you'll have to resign it.
This is where embedded binaries are placed:
Payload > .app > PlugIns > .appex
I've tried removing the PlugIns and resigning the whole bundle - seems to be working well.

Adding a Cocoa Touch Static Library as a subproject

How do I add a cocoa touch static library as a subproject to an application project in Xcode 4 (4.5 in this case)?
I have seen lots of screenshots that show a full project nested inside another project. However, whenever I follow the tutorials I just get a single .xcodeproj file inside my project, not a whole project (with it's own project and target etc).
I've tried to create a workspace too - but still no luck. What am I doing wrong? I've seen many questions on SO that seem to be similar but nothing that has helped me resolve this.
I had tried dragging in from Finder and it seemed to work for apps but not libs. #Eiko got it in the comments to another answer... It was because the project was open elsewhere at the time. If I goto File > Close Project (on the original library project in xcode) and then drag in from Finder it works.
Drag it from finder into the sidebar of xcode.
When doing it this way just now it worked for me.
and as #Eiko points out close the project if it is open elsewhere first, since it can only be opened once...