Completely remove XCode Target - ios

How do I completely remove an XCode target such that if I create a new target with the same name, none of the previous files/settings associated with it will remain?

I think you'll have to make a lot of manual work to do that:
open .xcodeproj with alt-click - Show Package Content
open project.pbxproj with the text editor
Now look for /* Begin PBXNativeTarget section */, you'll find the list of the targets below.
Here comes the part which will likely make you create the new project - there're so many cross-references by identifiers to be analyzed. You'll have to find yourself what you want to remove there.
remove xcuserdata to clear users preferences for the project

In xCode Version 9.2 (9C40b) onward you should be able to just right click the target you want to remove. xCode will do all the heavy lifting with file membership etc behind the scenes.

Related

Xcode 12 how to add an existing project to a workspace

I cannot believe how hard this is. Perhaps because the word 'workspace' is overloaded by Apple and perhaps because the UI keeps changing every version. For a newbie to iOS, Xcode and Apple it's a nightmare.
I have Xcode 12
I have created a project.
I used File/save as
workspace to create a workspace to (eventually) hold multiple
projects.
Gave it a name.
I have another already created project (a
static library) that I would like to add to this workspace.
I cannot for the life of me figure out how to do it. I see things for
previous Xcode versions but those UI options are not present in 12.
In the end I want to have a workspace where I have a demo project that uses the static library project for Bluetooth LE communications. I will be spending 90% of my time developing the BT library so I want to be able to access the source of both projects.
By the way, I am not using Storyboards. Not sure if that makes a difference, but just in case!
Thanks for any help
You can do this by
Close the project to add in Xcode
Drag the existing.xcodeproj file (one you closed) from Finder to Xcode and drop it next to existing sources/projects in the workspace
Xcode settings are often painful for even seasoned developers. And every update seems to break something.
As far as I can tell it just doesn't seem possible.
The only option seems to be to create the workspace in XCode 11 add the projects there then open in XCode 12
If you already have a Workspace (i.e. a .xcworkspace file) ready to go, all you need to do is:
Close your project
Open your Workspace
Go to File > Add Files to "<your_workspace_name>"...
Select your existing project
Xcode will duplicate the references to your files, so you manually have to go to the Project navigator (shortcut: ⌘ + 1), select the duplicated references (they'll be at your Workspace's root) and delete them (select Remove Reference, not Move to Trash)
Enjoy your Workspace!
For good measure, select your scheme (most times it'll become available immediately, but sometimes you'll need to restart Xcode), build, and run your project to verify that everything went well.
Verified in Xcode 13.

Xcode 6: No Frameworks Folder in Project Navigator

I am using Xcode 6 and following an Xcode version 4 tutorial so things are different here and there.
There doesn't seem to be a Frameworks folder in my project navigator and so when I downloaded some .framework files and added them manually in the build phase of my project editor, I had no Frameworks folder to save them in and just let them fall into the top of my project navigator. So they are there, just not in a special folder, and it doesn't look good.
So should Xcode 6 have a frameworks folder automatically, or do I need to create one myself? And if so, how can I do that? (I've only added new files so far).
In Xcode 6, the Frameworks folder is not added by default. You can drag and drop your .framework files into the project navigator (tick 'Copy items if needed'), then select them all > right click > "New Group from Selection" and name the folder 'Frameworks'.
Also, make sure the frameworks are added into the Project > Build Phases > Link Binary With Libraries. If not, drag them there from your newly created 'Frameworks' folder.
In short, no, you shouldn't need to create a Frameworks group yourself as Xcode is doing stuff automatically for you...
Apple are slowly, gently pushing developers in the direction of newer Clang features with the goal of making native iOS development more approachable for newbies who don't have previous experience of compiling and linking with C-based languages.
You'll find that Objective-C projects created with Xcode 6 have new build settings enabled by default including Link Frameworks Automatically (CLANG_MODULES_AUTOLINK) and Enable Modules (C and Objective-C) (CLANG_ENABLE_MODULES).
Suggested reading:
Modules (Clang documentation)
#import vs #import - iOS 7 (excellent Stack Overflow answer)
I found the other answers too confusing (where am I supposed to get .framework files?)
It's way simpler in Xcode 6. Just go to Capabilities and turn Maps on. That's it... really.
I would recommend using drag and drop feature to move files into Xcode. Xcode show you the Choose options for adding these files window [Copy items if needed] [Added folders]
For example Xcode can automatically add relative path ($(PROJECT_DIR)/) to:
Build Settings -> Library Search Paths if you drag and drop a library
Build Settings -> Framework Search Paths if you drag and drop a framework

Xcode 5.1.1 not recompiling subproject

I have 2 projects within my workspace (see screenshot), but when I make changes to my secondary project (SDK), it doesn't recompile them. For example if I just write random uncompiling code, it still compiles. Xcode also doesn't break at those breakpoints in the secondary project but it breaks in the primary project. I've tried deleting DerivedData and also cleaning the workspace. Any ideas? Thanks!
Check in the Utilities of Xcode if the .m files from your secondary project are in the Target membership.
UPDATE
I think I just replicate your problem on my side, and found the solution that fixes it. Try going in Products > Scheme > Edit Schemes. Select your primary project scheme in the upper left part of the view, the go in the Build section in the left menu. Click on the plus sign and add your secondary project target.

After changing project name, cannot find version setting

Using XCode 4 for iOS. I changed the project name of my program to something more user friendly and readable. I can no longer find the version setting.
Is there another setting I need to change to view and edit version/build?
Thanks...Rick
I have tried in XCode and rename the project.
The Xcode will automatically ask you to rename the target etc.
Afterward, I could still find the version and build in Target summary and info.
I rename the project name in the following way :
1. Select Project (the top row with blue icon)
2. Press Enter
3. Rename
4. And continue with xCode suggestion for renaming other related files
I hope this help

How to update a framework in an iOS app?

I'm writing an app using Nuance's SpeechKit framework. I've just downloaded a newer version of the framework that contains new methods in some of the classes. To upgrade, I deleted the framework and the re-added the new one. When I right-click on the framework in Xcode and click "reveal in finder", it shows the new framework. When I open up the "Headers" subfolder of the framework in Xcode, I see the new methods.
The problem is that my class seems to still be referencing the header file in the old location, as the new methods are not visible within my application.
How do I upgrade a framework properly? Is there somewhere else in Xcode that contains a path reference to the SDK?
You need to delete Derived Data for the project - it is an option of the project in the XCode Organizer, on the projects tab. It will remove the cached build of the framework, forcing XCode to use the new one.
Choose Window/Organizer from the top menu
Click "Projects" pseudo-tab-thing, along the top of organizer window (icon looks like an XCode project file"
Select the project from the list on the left
Click "Delete" next to "Derived Data" in the area immediately below the project info header.
List item
EDIT: as of XCode 12 (should work with Xcode 8 and above), you can delete derived data like this:
Go to File > Workspace Settings if you are in a workspace environment or File > Project Settings for a regular project environment.
Then click over the little grey arrow under Derived data section and select your project folder to delete it in Finder.
I found what cause this issue for us.
When you build a new version you must update "Current Library Version".
There is also a "Compatibility Version"
In Xcode selector your framework target and in build settings search for linking and you will se this setting there.
We created a build script to bump this version number every time we build.
Xcode caches the frameworks and uses the cache if possible. That's why you need to change this number.
If you are using CocoaPods, run pod update [PODNAME].

Resources