0

I have created a Mac OSX Core Data business app. My issue is that whether I am running the app in Debug mode via Xcode or running my own personal production version (from the Mac App Store), both use the same data (i.e. the same sandbox area). I need to be able to mess with the Debug version data without affecting my production copy. Is there a Project Setting I can use to change the debug sandbox location, or at the very least change the data location?

N Gill
  • 21
  • 10

1 Answers1

0

I have separated my Live/Debug data in the code, specifically in AppDelegate.swift/applicationDocumentsDirectory, by changing the directory used when in Debug mode.

I used the solution found here to differentiate between a DEBUG & RELEASE build.

I first set the DEBUG and RELEASE symbols here under Swift Compiler - Custom Flags: screenshot

Then in the code I return the data directory based on the DEBUG symbol:

#if DEBUG
        return appSupportURL.URLByAppendingPathComponent("com.MyCompany.AppName.Debug")
    #else
        return appSupportURL.URLByAppendingPathComponent("com.MyCompany.AppName")
    #endif
Community
  • 1
  • 1
N Gill
  • 21
  • 10