Bundle Identifier Change Core Data Lost

Hello,


I changed a project from Objective-C to Swift and created a whole new project when I did this. I have an app in the AppStore and wanted to send an update instead of releasing a new app.


I understand that my Bundle Identifier needs to be the same when updating an app. When preparing the app for release, I changed my Bundle Identifier to match my app in the AppStore - since I started with a new project - and in the process my Core Data file seems to be missing. If I change my Bundle Identifier how do I keep access to Core Data?


Take care,


Jon

Accepted Reply

This took me a while to figure out but here is how I fixed the issue.


1. Change your product name under Build Settings -> Packaging -> Product Name to the desired product name. This will change you Bundle Identifier to the desired name.

2. Clean your project by selecting Product -> Clean.


3. Select your CoreData model in the project navigator and then select the "Data Model Inspector" in the Inspector tab. Change the project name under class to the new class name. I got stuck here since I did not know Spaces, dashes, . are all replaced by underscores. You can see that my Product Name is FLO-Cycling and the CoreData class is FLO_Cycling.



4. If you have imported the Swift bridging header file anywhere make sure to update it.


I hope this can help someone.


Take care,

Jon

Replies

I'm betting you did a bad thing in the process of conversion.

This took me a while to figure out but here is how I fixed the issue.


1. Change your product name under Build Settings -> Packaging -> Product Name to the desired product name. This will change you Bundle Identifier to the desired name.

2. Clean your project by selecting Product -> Clean.


3. Select your CoreData model in the project navigator and then select the "Data Model Inspector" in the Inspector tab. Change the project name under class to the new class name. I got stuck here since I did not know Spaces, dashes, . are all replaced by underscores. You can see that my Product Name is FLO-Cycling and the CoreData class is FLO_Cycling.



4. If you have imported the Swift bridging header file anywhere make sure to update it.


I hope this can help someone.


Take care,

Jon

192.168.203.1