简体   繁体   中英

Using App delegate / View Controllers of one project in another project

I have a situation where I need to make a branded app for different users and the requirement is such that I create different iOS app for each user. I have all my code ( AppDelegate and all ViewControllers and its implementation files) in one main xcode project.

I have created new empty xcode project and I have included my main project in this new project. Now I want my new empty xcode project to run in the way as if I am using my main project. So, How can I use the main project's app delegate and its starting ViewController from my new empty Xcode project?

In your main.m class import the AppDelegate class from your other project and than launch it

#import <OtherProject/AppDelegate.h>

int main(int argc, char * argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM