Problems in TTTableview class using Three20 in iPhone? - iphone

Now I am using Three20 in my apps. I have a problem, when I run the application with MainWindow.xib, the TTTableview class isn't called. But without MainWindow.xib it would call the TTTableview class. I don't know why it's happening. Please help me out.
Thanks.

In your AppDelegate code
delete the mainWindow.xib
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions {
if (![navigator restoreViewControllers]) {
[navigator openURLAction:[TTURLAction actionWithURLPath:kAppRootURLPath]];
}
}
In main.m
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, #"YOURAppDelegate");
[pool release];
return retVal;
}

Related

UIApplication delegate method is not called

I have a problem integrating Facebook SDK 3.2 with my app, my app goes to facebook app for approval and login, but when
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
needs to be called when facebook authorization is done, it simply skips it.
It works great when I force webView facebook login via modal viewcontroller, but when I want to use installed facebook app/safari it just doesn't work.
Any suggestions?
Thank you.
Make sure you put UIApplicationDelegate in interface declaration.
#interface AppDelegate : NSObject <UIApplicationDelegate>
Also verify its right App delegate class
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, #"AppDelegate");
[pool release];
return retVal;
}
Also add fb Id in plist.

how to change property located in .plist called 'Main nib file base name' at run time

I have already added my MainWindow.xib file name in .plist file, if i want to change it at run time by another file name MainWindow2.xib. How do we change it by code?
You can't, since the info.plist is readonly on with the app bundle. You will have to do it by code.
Remove all mainwindows from the info.plist and here is an example:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *rootViewController = nil;
// Override point for customization after application launch.
if (YES) { //You check here
rootViewController = [[SomeViewController alloc] initWithNibName:#"SomeViewController" bundle:nil];
} else {
rootViewController = [[OtherViewContoller alloc] initWithNibName:#"OtherViewContoller" bundle:nil];
}
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
The in the main.m:
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

Implement auto log-off feature in Iphone

I am making an application which logs in using some username and password. Now when i am logged in succesfully I want my application to be logged out automatically if no interaction with the application found for 10-12 minutes.
Can anybody guide me how can i achieve this ??
Help with some code will be really appreciated.
Thanks
The Thing you want to implement is called SESSION MANAGEMENT.You have to subclass the UIApplication.
#interface MyUIApp : UIApplication {
}
In this class you have to reset the timer each time. Also you have to check if the application is responded or not with this.If the idleTimer is Exceeded then push the viewController to your login view.
- (UIResponder *)nextResponder {
[self resetIdleTimer];
return [super nextResponder];
}
Also you have to change the main class file with this:-
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSString* appClass = #"MyUIApp";
NSString* delegateClass = nil;
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, appClass, delegateClass);
[pool release];
return retVal;
}

Generic Program received signal: “SIGABRT” with NSZombie ONLY on iOS SDK 4.0

my project works on iphone/ipad sdk except SDK 4.0.
It crash with stupid Program received signal: “SIGABRT”.
I've activated NSZombie, Debug all lines, but nothing.
Debugger crash before main() in main.m and I not unable to solve the problem.
This is main.h:
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, #"AppDelegate");
[pool release];
return retVal;
}
...and this is AppDelegate:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
and this is my view Controller :)
- (void) viewDidLoad {
[super viewDidLoad];
}
This app use external library as libz.dylib and a custom static lib myLib.a.
Use all of this frameworks:
- QuartCore
- CFNetwork
- CoreLocation
- UIKit
- Foundation
- CoreGraphics
- SystemConfiguration
Is there a know issue to solve this problem?
I don't understand what is the casuse...
Any idea please?
thanks.
try to add [super viewDidLoad] in your viewDidLoad method
- (void) viewDidLoad {
[super viewDidLoad];
}
Solved compiling myLib.a from 3.0+ with no CLLocationCoordinate2DMake (that not exist on sdk <4)!
thanks

How many parameters does the main function take?

I am a iPhone beginner and i want to know how many parameters the main function takes.
you generally don't touch the main method.
typically you begin entering your code in your application delegate, specifically:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
The main() function is a standard C main(). It takes two parameters:
int main(int argc, char *argv[]) {}
As Isaac notes, usually you will use the main.m provided for you by XCode:
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}