0

I need to make several versions of an iOS application each with a different target and name. Most of the differences between the applications are in the applications resources and not the source code. I am trying to share as much source code across versions as possible.

My issue arises when I try to access the application object in a version which does not have the same name as the original. For instance, I have two versions of the application named UserApp and UserApp2 and the following code which references the data store:

var user = UserApp.User

When I try to run this code in the UserApp2 target, it throws an error saying UserApp is undefined.

My question is: How can I make this code load the proper application object depending on what target is currently running? I would like a solution that can be used across all targets without the need to change code.

EDIT: The UserApp object is an XCDataModel.

Adam Jakiela
  • 2,188
  • 7
  • 30
  • 48

1 Answers1

0

The UserApp class might not be added in all of your application targets. verify the target membership for the class.

enter image description here

Shoaib
  • 2,286
  • 1
  • 19
  • 27