Skip to content
Search

XCode

lastmod 2025-05-16created 2014-01-1142 edits

Xcode is a suite of OS X development tools developed by Apple. Version 3.2 is included with Mac OS X 10.6 but is not installed automatically. Earlier versions of Mac OS X do not support 3.2, so older versions can be downloaded free of charge from Apple Developer Connection.

Xcode's main program is the integrated development environment of the same name. It includes Apple's developer documentation and Interface Builder, which is used to build graphical interfaces.

Xcode includes modified versions of the free software GCC (GCC, apple-darwin9-gcc-4.2.1, apple-darwin9-gcc-4.0.1) and supports C, C++, Fortran, Objective-C, Objective-C++, Java, AppleScript, Python, and Ruby, including various programming models for Cocoa, Carbon, and Java. Third parties provide support for GNU Pascal, Free Pascal, Ada, C#, Perl, Haskell, and D. Xcode uses GDB as its debugger back end.

Categories

License agreement

$ sudo xcodebuild -license

Install commandline tools

$ xcode-select --install

The following error usually occurs after an OS update; in that case, the command above fixes it.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Compile options

Preprocessor-Options

GCC preprocessor directive options used in XCode (based on LLVM GCC 4.2)

-x objective-c++
http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Preprocessor-Options.html
Sets the source language to Objective-C++. (Add it to 'Other C++ Flags'.)

Command Line Tools

To use commands such as compiling from the command line, you must install them separately from the Apple website. If they still don't run properly after installation, enter the command below.

$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/

Keyboard shortcut

A list of XCode keyboard shortcuts.

Key

Brief

Remarks (ko)

Common

Shift + Command + F

Show the find navigator

Switches to the search navigation bar.

Shift + Command + O

Open Quickly (File or Symbol)

Opens a dialog for quickly looking up symbols.

Control + Command + Up (Down)

Header / Source File switch

Switches between the header and source file.

Control + I

Re indent

Readjusts the tabs (indent) of the source code.

Control + Command + Left (Right)

Go Back (Go Forward)

Goes back to the previously focused position in the Editor.

Debugging

Command + Y

Deactivate Breakpoints

Disables all breakpoints.

Control + Command + Y

Continue (Stop)

Resumes or pauses the program while debugging.

F6

Step Over

Advances the debugging cursor one step. (It does not change the depth of the call stack.)

F7

Step Into

Advances the debugging cursor one step.

F8

Step Out

Exits the current call stack frame.

Build Path

The default location where build output is stored is as follows.

/Users/{username}/Library/Developer/Xcode/DerivedData/{projectname}-{key}/Build/Products에 위치한다.

Marker

A feature that adds marks, similar to #region in C#. Add it to the code as follows.

#pragma mark -
#pragma mark LABEL

Debugging

Notes related to debugging.

Memory trace

To trace the memory at the location where an error occurred, do the following.

  • Application (app) tab > Edit Scheme... > Run > Arguments > Environment Variables
    • NSZombieEnabled : YES
    • MallocstackLoggingNoCompact : 1

Once the settings above are done, you can get the address of where the error occurred, as below.

-[CFString release]: message sent to deallocated instance 0x5e4780

Enter the following command after the (gdb) prompt in the black debug area at the bottom (Shift + Cmd + Y)

$ info malloc 0x5e4780

or

$ info malloc-history 0x5e4780

This lets you find the source code location where the error occurred.

Wireless debugging

After connecting the device via USB, select the following menu:

XCode-Menu-Window-Devices_and_Simulators.png

Select the Connect via network checkbox.

XCode-Devices_and_Simulators.png

Provisioning

Troubleshooting

Loading Environment Variables in Xcode

To add environment variables to XCode, add them under User-Defined in Project > Build Settings. Note that you can add CPATH, LIBRARY_PATH, etc. here.

XCode Auto Completion

Error: The app icon set named "AppIcon" did not have any applicable content

You must put a 120x120 image of exactly that size into images.xcassets.

NSPOSIXErrorDomain: Operation not permitted

There are the following options.

  • Delete the DerivedData folder 3
  • Clean the project
  • Reinstall Xcode (a lower version that worked well)
  • Delete Build Setting > VALID_ARCHS.

Note that if this error occurs in Godot, check whether the TargetFrameworks version in the .csproj file matches the version for the release build.

warning: pointer is missing a nullability type specifier

When the following warning is printed:

<File>: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]

To remove the warning, add the -Wno-nullability-completeness option.

Favorite site

XCode usage and terminology

XCode Plugin

References


  1. Theeye.pe.kr_-_Xcode_No_matching_provisioning_profiles_found.pdf ↩

  2. Create_an_iOS_certificate_and_provisioning_profile_-by_Nova_Woo-_Medium.pdf ↩

  3. (XCode) Deleting DerivedData ↩

author Zer0 sitemap