Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@beny
Last active March 14, 2022 11:41
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save beny/8313959 to your computer and use it in GitHub Desktop.
Save beny/8313959 to your computer and use it in GitHub Desktop.
Xcode tips

Core Data

  • -com.apple.CoreData.SQLDebug 1-3 - print all SQL queries called by Core Data
    • -com.apple.CoreData.Logging.stderr 1-3 - needed alongside with the SQLDebug from iOS 10+ because of new logging system, more on that in changelog
  • -com.apple.CoreData.SyntaxtColoredLogging YES - probably syntax colored logging (not tried)
  • -com.apple.CoreData.SQLiteDebugSynchronous 1 - preference controls some aspects of the SQLite store. See the "Configuring a SQLite Store's Save Behavior" section of the Core Data Programming Guide for details
  • -com.apple.CoreData.SQLiteIntegrityCheck 1 - the SQLite store does extra integrity checking
  • -com.apple.CoreData.MigrationDebug 1 - Core Data will log information about exceptional cases as it migrates data
  • -com.apple.CoreData.ThreadingDebug - preference enables assertions to enforce Core Data's multi-threading policy. It is a number, where increasing values enable more debugging. A value of 3 is recommended. This feature requires the debug variant of the framework

UI

  • -NSDoubleLocalizedString YES - doubles the length of every localized string
  • -UIViewShowAlignmentRects YES - shows alignment rects in UI
  • -NSForceRightToLeftWritingDirection YES - simulates right-to-left language
  • -UIStateRestorationDebugLogging YES

Cocoa

  • NSAssert(getenv("NSZombieEnabled"), @"Braaainz (also turn off zombies") - just memo for turn off zombies

Localizations

  • -AppleLocale cs_CZ - starts app with selected locale
  • -AppleLanguages (en) - starts app with selected locale
  • -NSShowNonLocalizedString YES - probably show strings without applied NSLocalizedString (not tested)

Swift

  • -Xfrontend -debug-constraints - gory details of what the type checker's thinking (use on compiler)

Xcode

  • defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
@clementpadovani
Copy link

Does -com.apple.CoreData.ThreadingDebug work? If so I can’t seem to get it to work, is the Core Data debug framework still available?

Thanks

@beny
Copy link
Author

beny commented Jul 5, 2014

Not all of these flags currently works or are testes. It's just a list which I discovered somehow or somewhere. I think that Core Data debug framework isn't updated by Apple so often so it's possible that it does not work.

@victor
Copy link

victor commented Feb 1, 2015

I think it is called -com.apple.CoreData.ConcurrencyDebug nowadays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment