115

i have downloaded new xcode-5 and just started using it.

We can create application directly including storyboard and ARC , it is not asking for option like earlier versions.

So, my question is how can we use xcode5 without ARC and storyboard. we have to manually remove storyboard file ? or is there any other option.

PJR
  • 13,052
  • 13
  • 64
  • 104
  • 3
    No one can really answer this, but I think Apple did it because both Storyboards and ARC are the future in developing apps with Xcode or in Objective-C. Since Xcode 5 is still a beta it might be that they add support for it later this year but I think that's not gonna happen. – HAS Jun 21 '13 at 11:32
  • 6
    Remove the storyboard file manually, and remove the `-fobjc-arc` compiler flag in the project settings. –  Jun 21 '13 at 11:34
  • Have you tried opening a project made by xcode with previous versions? – Adil Soomro Jun 21 '13 at 11:36
  • To remove ARC, you can do what @H2CO3 suggested. As far as removing Storyboard goes, try adding a new UIViewController. It still has the option to check "With XIB for user interface". You'll just have to change your AppDelegate accordingly to set that UIViewController as your rootViewController. – Anil Jun 21 '13 at 11:38
  • 19
    Questions about tools primarily used by programmers ***are very much on topic***, provided that they don't ask for the 'best' of something or 'shopping' recommendations. I've reopened this accordingly. – Tim Post Jul 29 '13 at 10:07
  • Unfortunately we can not discuss XCode 5, or iOS 7 because they are both under NDA. If you need to ask any questions regarding this, please ask on the Apple Developer Forums. – MZimmerman6 Jul 29 '13 at 11:13
  • As shown in my answer , it is working . Yes i know it is under NDA but i think if some one testing with xcod 5 and want to know about this , it may be helpful for him :) – PJR Jul 29 '13 at 11:34
  • 1
    But this is not the proper place to do so. Do understand that. – MZimmerman6 Jul 29 '13 at 11:40
  • 3
    the only thing that makes this under NDA is the words "Xcode 5" part. anything actually described can be done on previous versions of Xcode so technically this topic is free to discuss. – AtomRiot Sep 16 '13 at 15:53
  • 1
    In order to get the "Use Storyboards" option back, I came across this script: http://stackoverflow.com/a/19792955/329928 – Chris Leyva Dec 17 '13 at 13:47

6 Answers6

150

Create a project with an Empty application and Add any viewcontroller (i added TestViewController here)

   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
 {
   self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
   // Override point for customization after application launch.
   TestViewController *test = [[TestViewController alloc]     initWithNibName:@"TestViewController" bundle:nil];
   UINavigationController *nav = [[UINavigationController alloc]  initWithRootViewController:test];
   self.window.rootViewController = nav;
   [self.window makeKeyAndVisible];
   return YES;
 }

STEPS FOR REMOVE ARC

1) In build setting set Automatic Reference Counting to NO.

///////////////////////////////////////////////////////////////////////////END///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

If you have Already Created Application with storyboard and ARC then

STEPS FOR REMOVE STORY BOARD

1) Remove Main.storyboard file from your project.

2) Add new files with xib for your controller , if it is not added in compiled sources in build phases then add there manually.

3) Remove Main storyboard file base name from plist.

4) Change appdelegate didFinishLaunchingWithOptions file and add :

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;

[self.window makeKeyAndVisible];

just like :

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;

     // Override point for customization after application launch.

     TestViewController *test = [[TestViewController alloc]     initWithNibName:@"TestViewController" bundle:nil];
     UINavigationController *nav = [[UINavigationController alloc]  initWithRootViewController:test];
     self.window.rootViewController = nav;
     [self.window makeKeyAndVisible];

     return YES;
}


Now,in above example you have to manage memory management manually like ,

 self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 

 [test release]; 

STEPS FOR REMOVE ARC

1) In build setting set Automatic Reference Counting to NO.

PJR
  • 13,052
  • 13
  • 64
  • 104
  • 7
    Isn't there an "empty project" option any more? I don't think I will every start using storyboards. – Sulthan Sep 20 '13 at 07:22
  • 1
    Be sure to change your Target's "Main interface" setting to your new root . – Paul Brady Sep 28 '13 at 00:43
  • you are right @Sulthan we can do it by empty project , but these are the changes if i already crated view based application. (we have to remove some storyboard code manually from appDelegate file) while in empty application we have to add new code in it :) – PJR Oct 03 '13 at 11:32
  • I came across a script that will add the option to remove storyboards back: http://stackoverflow.com/a/19792955/329928 – Chris Leyva Dec 17 '13 at 13:46
  • why isn't the UINavigationController *nav not autoreleased? and we should use _window in [UIWindow alloc]? – hariszaman Jul 31 '14 at 09:44
44

Instead of delete the storyboard file, you can Create a new project with Empty Application template. So that you can avoid the storyboard file creation.

Use following steps to omit storyboard: enter image description here

  1. Create a new project with Empty Application template.
  2. Add a new viewController (Example: LoginViewController)
  3. Change the didFinishLaunchingWithOptions in AppDelegate.m file as specified below.

Change To:

#import "LoginViewController.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];

    LoginViewController *loginVC = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
    UINavigationController *navigationController = [[UINavigationController alloc]  initWithRootViewController:loginVC];

    self.window.rootViewController = navigationController;
    [self.window makeKeyAndVisible];

    return YES;
}

Remove ARC: Go to Build Setting -> Objective-C Automatic Reference Counting -> NO

Raj Subbiah
  • 1,292
  • 11
  • 20
  • 1
    Wow! Works like a charm and much simpler than the accepted answer. I just had to be sure to change *all* of the references to `LoginViewController` to match my own controller's name. – JohnK Oct 08 '13 at 16:43
11

create new project

![Create new Project]

remove Main storyboard file base name in Info

//remove Main storyboard file base name in Info

Add This Code In appdelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];

    LoginViewController *loginVC = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
    UINavigationController *navigationController = [[UINavigationController alloc]  initWithRootViewController:loginVC];

    self.window.rootViewController = navigationController;
    [self.window makeKeyAndVisible];

    return YES;
}

Then automatic remove your storyboard.

Please Try this... successfully Executed. thanks

Ketan Ubhada
  • 275
  • 3
  • 14
5

ShortCut: I Prefer

Create the project without Storyboard and ARC in xcode4 and then open that project in xcode5 .

SwapnilPopat
  • 517
  • 5
  • 26
  • 1
    Keeping around an older version of Xcode just for that is not worth it. I'd rather create a new project, get rid of the Storyboard stuff, add UIWindow instantiation in appDelegate and save it as a template project for later. – kervich May 14 '14 at 15:34
3

Xcode 4 had the "Use Storyboards" checkbox when you created a new project. It is possible to grab the old Xcode 4 application templates (XML files) and convert them to Xcode 5. That way, you get the old templates back that let you choose whether you want storyboards or not.


I wrote a script that does all that work for you: https://github.com/jfahrenkrug/Xcode4templates


After running the script, you will have an "Xcode 4" section in the "New Project" screen:

enter image description here

And then - Alas! - you get your beloved choices back:

enter image description here

You will need a copy of the Xcode 4 .app bundle from http://developer.apple.com/ios to use this script.

Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165
  • 1
    However, those templates are old and don't take advantage of all the new changes available, such as -registerClass:forCellReuseIdentifier:. – mahboudz Jan 13 '14 at 23:11
  • @mahboudz That is true. You need to tweak that if that functionality is important to you. Of course I hope that Apple will bring back the option to opt-out of Storyboards in a future release of Xcode. – Johannes Fahrenkrug Jan 14 '14 at 13:09
  • 1
    I hope so. Like you, I use Storyboard in smaller apps, mostly due to the quick TableView development, but in larger apps, Storyboard is a major major pain. From scrolling around, to remembering segue IDs (they've got to add a way to utilize #defines or const NSString* between Storyboards and source files), to doing git conflict resolution, and more, Storyboards just aren't the be all and end all. – mahboudz Jan 15 '14 at 07:28
  • those V/A arrows though. – John Riselvato Feb 24 '14 at 19:12
  • 1
    @JohnRiselvato You are right :) The obnoxious arrows are gone now :) – Johannes Fahrenkrug Feb 24 '14 at 20:28
0

I have a Tip:

  1. The First: I create my project by XCode 4.6 (Because this version is nearest to XCode 5).
    • Of course that with XCode 4.6, you can chose use or not using ARC, Storyboard.
  2. The Second: After that I will open my Project with XCode 5. => I think that Xcode 5 will understand that project is use nonARC, and of course, do not have Storyboard.

I hope your project will work! :D

Linh Nguyen
  • 2,006
  • 1
  • 20
  • 16