Ετικέττα : cocoa

Build/Debug Xcode Project from Terminal – Part II

Build Xcode project from Command Line

Tired of having Xcode open all the time, with all its overhead, simply for re-building your project? Use the terminal!

(*) Install Command Line Tools

Make sure the command line tools are installed. (On Mavericks/Yosemite, they’re not). If not, install them using :

xcode-select --install
1. Check out your available build settings
xcodebuild -project YourProjectName.xcodeproj -list
2. Build it using the desired scheme/target/configuration. E.g.
xcodebuild -project YourProjectName.xcodeproj -scheme YourSchemeName -configuration Release

View-Based NSOutlineView example

Manually sandboxing a Cocoa app

(Valid for pre-10.7 Xcode installations, where the “Enable Sandboxing” option is unavailable).

Steps :

  1. Create a new Plist in your projects root directory, named e.g. yourappname.entitlements
  2. Set com.apple.security.app-sandbox to YES
  3. Add all other necessary options
  4. Verify that a Code Signing Identity has been set
  5. Under Build Settings, set Code Signing Entitlements to yourappname/yourappname.entitlements

Example : (using old-style plist format)

{
   "com.apple.security.app-sandbox" = true;
   "com.apple.security.files.user-selected.read-write" = true;
   "com.apple.security.print" = true;
}

Create & Use a Cocoa Static Library

Create the Library

  1. Create a New Project, using the built-in Cocoa Library template
  2. Set Library type as Static
  3. Add your Classes/Functions/Whatever
  4. Under Build Phases, take care of which headers are going to go Public

Use the Library in a test project

  1. Drag’n’drop the final .a library file into the project (doesn’t matter if you also copy it to the target directory)
  2. Link against the library
  3. Update the User Header Search Paths to your initial Library .a file origin (using recursion)
  4. Set Always search user paths to YES
  5. Add -ObjC to Other Linker Flags, under Build Settings.



*Διαδικαστικά πραγματάκια που μού πέρνουν 100 ώρες μέχρι να τα κάνω να δουλέψουν, από δω και στο εξής θα τα δημοσιεύω μπας και “μείνουν” και την επομένη φορά γλιτώσω και πολύτιμο χρόνο… (α, και επειδή είμαι υπέρμετρα αλτρουιστής και θέλω να συνεισφέρω στο…community :p)