Hallo zusammen,
nachdem ich endlich meine erste App , zur Berechnung von Ranglistenpunkten, programmiert habe und auch auf ein iPhone über Cydia installiert habe, stehe ich jetzt als Anfänger gerade vor einem Problem , dass
ich die App im Simulator super bedienen kann, aber wenn ich sie auf dem iPhone öffne sehe ich zwar das Ladebild aber dann stürzt die App sofort ab.Wo könnte den das Problem liegen?
Hier mal der Code:
main.m
Alles anzeigen
AppDelegate.h
Alles anzeigen
AppDelegate.m
Alles anzeigen
ViewController.h
Alles anzeigen
ViewController.m
Alles anzeigen
Schon mal vielen Dank im Voraus
nachdem ich endlich meine erste App , zur Berechnung von Ranglistenpunkten, programmiert habe und auch auf ein iPhone über Cydia installiert habe, stehe ich jetzt als Anfänger gerade vor einem Problem , dass
ich die App im Simulator super bedienen kann, aber wenn ich sie auf dem iPhone öffne sehe ich zwar das Ladebild aber dann stürzt die App sofort ab.Wo könnte den das Problem liegen?
Hier mal der Code:
main.m
Quellcode
AppDelegate.h
Quellcode
AppDelegate.m
Quellcode
- #import "AppDelegate.h"
- #import "ViewController.h"
- @implementation AppDelegate
- @synthesize window = _window;
- @synthesize viewController = _viewController;
- - (void)dealloc
- {
- [_window release];
- [_viewController release];
- [super dealloc];
- }
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
- // Override point for customization after application launch.
- self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
- self.window.rootViewController = self.viewController;
- [self.window makeKeyAndVisible];
- return YES;
- }
- - (void)applicationWillResignActive:(UIApplication *)application
- {
- /*
- Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
- */
- }
- - (void)applicationDidEnterBackground:(UIApplication *)application
- {
- /*
- Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- */
- }
- - (void)applicationWillEnterForeground:(UIApplication *)application
- {
- /*
- Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
- */
- }
- - (void)applicationDidBecomeActive:(UIApplication *)application
- {
- /*
- Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- */
- }
- - (void)applicationWillTerminate:(UIApplication *)application
- {
- /*
- Called when the application is about to terminate.
- Save data if appropriate.
- See also applicationDidEnterBackground:.
- */
- }
- @end
ViewController.h
Quellcode
- #import <UIKit/UIKit.h>
- @interface ViewController : UIViewController
- @property (retain, nonatomic) IBOutlet UITextField *outAnzahl;
- @property (retain, nonatomic) IBOutlet UITextField *outPlatz;
- @property (retain, nonatomic) IBOutlet UITextField *outFaktor;
- @property (retain, nonatomic) IBOutlet UILabel *outErgebnis;
- - (IBAction)textFieldDoneEditing:(id)sender;
- - (IBAction)klick:(id)sender;
- @end
ViewController.m
Quellcode
- #import "ViewController.h"
- @implementation ViewController
- @synthesize outAnzahl;
- @synthesize outPlatz;
- @synthesize outFaktor;
- @synthesize outErgebnis;
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
- }
- #pragma mark - View lifecycle
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
- }
- - (void)viewDidUnload
- {
- [self setOutAnzahl:nil];
- [self setOutPlatz:nil];
- [self setOutFaktor:nil];
- [self setOutErgebnis:nil];
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- }
- - (void)viewDidAppear:(BOOL)animated
- {
- [super viewDidAppear:animated];
- }
- - (void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- }
- - (void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- // Return YES for supported orientations
- return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
- }
- - (IBAction)textFieldDoneEditing:(id)sender{
- [sender resignFirstResponder];
- }
- - (IBAction)klick:(id)sender {
- NSNumberFormatter *formatter = [[NSNumberFormatter new] autorelease];
- [formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"de_DE"] autorelease]];
- NSString *eingabefaktor = outFaktor.text;
- NSNumber *number = [formatter numberFromString:eingabefaktor];
- float umwandlung =[number floatValue];
- float result = umwandlung * 100 * (( [outAnzahl.text floatValue] + 1 - [outPlatz.text floatValue]) / [outAnzahl.text floatValue]);
- outErgebnis.text = [NSString stringWithFormat:@"%f",result];
- }
- - (void)dealloc {
- [outAnzahl release];
- [outPlatz release];
- [outFaktor release];
- [outErgebnis release];
- [super dealloc];
- }
- @end
Schon mal vielen Dank im Voraus