xcode backward compatibility methods - ios

I've a project that runs perfectly (I hope :)) on ios 6 SDK.
When I try to test it on ios 5 simulator, I've a blank view so I suppose that I've used some uncompatible methods.
How Can I discover and verify which methods doesn't works?
Or are there some problems with my xib?
EDIT:
My appDelegate code:
LoginViewController *loginViewController =
[[LoginViewController alloc] initWithNibName:"LoginViewController.xib" bundle:[NSBundle mainBundle]];
navigationController = [[UINavigationController alloc] initWithRootViewController:loginViewController];
navigationController.navigationBar.hidden = YES;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = navigationController;
if (![self connect]){}
[self.window makeKeyAndVisible];

"Apple and backward compatibility" is an oxymoron. It is not interesting to Apple if you publish apps that use older than the current iOS version, you know how hard they force developers and consumers to move on. I wouldn't bother and I would set the bottom line at 6.

Related

Who is responsible for creating the window under the hook when using storyboards

if we are using storyboards to deliver the interface setting in out ios app, then the AppDelegate.m will be quite clean and the only thing we are caring about is making our logic code enter at the viewDidLoad() function in the viewController which we hooked with a storyboard.
And there is a way that wildly used when we choose not to load the storyboard and make our window ourself at Application didFinishLanchingWithOption method of AppDelegate.m like this:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
ViewController *viewController = [[ViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewController];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
return YES;
the document says there should be a window and a rootViewController for our app to present stuff on the screen.
But if we are using the storyboard, who did this stuff for us? I mean things like creating the window and assign the rootViewController?
And can we choose what kind of rootViewController when using storyboard?
And once a rootViewController is assigned, can we choose to replace that?
Mostly I am asking how did all the stuff organized under hook

iOS 8 Landscape mode not work properly an Not Rotating app

i am developing app using ios8 support with portrait and Landscape mode both,
but problem is that when i try to rotate my Device to Landscape mode it cant work for me.
i test same thing in my other device iPhone 4 with ios7.1.2 it work fine but not working with ios 8.1 in iphone 4s
please give me suggestion if any one also have the same problem.
ARViewController* metaioCloudPlugin = [[ARViewController alloc] initWithNibName:#"ARViewController" bundle:nil];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = metaioCloudPlugin;
[self.window makeKeyAndVisible];
====
This is my AppDelegate code for main window root view.
Thanks in advance.
i fixed this issue .
Remove below line from code and its work fine now.
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
refer this link
iOS 8 - App not rotating appropriately
I was facing the same issue, while I was updating the xib base project for iOS8,
I found the solution inside your question,
thanks for asking :)
self.window.rootViewController = loginScreen;
While navigating to the screen
loginScreen = [[LoginScreen alloc] initWithNibName:#"LoginScreen" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:loginScreen];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = loginScreen;
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];

Xcode 5, disabling Storyboards [duplicate]

This question already has answers here:
Xcode without Storyboard and ARC
(6 answers)
Closed 9 years ago.
I don't want to use story boards, i'd much rather use NIB's for UI when necessary, and I particularly don't want to use them for the default templates.
Xcode 5 no longer has the check box to say you don't want to use Storyboards,
can anyone help? It's really annoying...
STEPS FOR REMOVE STORY BOARD - XCode 5 (EDIT)
1/ Create an empty 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.
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;
}
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;
}
Have a look here
Use this script to get all the shiny, happy glorious goodness of the Xcode 4 templates back: https://github.com/jfahrenkrug/Xcode4templates
You will need a copy of the Xcode 4 .app bundle to use this script.

xcode 5 - open a project without story board [duplicate]

This question already has answers here:
Xcode without Storyboard and ARC
(6 answers)
Closed 9 years ago.
I've recently downloaded the new xCode from the developers' site, and everywhere I look, I can't find a solution as to how to open a project without storyboard.
It's important to me because I want to keep my apps working on iOS 4.3.
The way I do it, is by opening the project in the old version and then opening it in the new one. But there must be another way.
Thanks!
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;
}
Just pick the Empty Application template, my friend

Xcode without Storyboard and ARC

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.
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.
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:
Create a new project with Empty Application template.
Add a new viewController (Example: LoginViewController)
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
create new project
![Create new Project]
//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
ShortCut: I Prefer
Create the project without Storyboard and ARC in xcode4 and then open that project in xcode5 .
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:
And then - Alas! - you get your beloved choices back:
You will need a copy of the Xcode 4 .app bundle from http://developer.apple.com/ios to use this script.
I have a Tip:
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.
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

Resources