Sany Inviato 1 Marzo 2011 Segnala Condividi Inviato 1 Marzo 2011 Come da titolo, cosa posso fare? ho 2 warning uguali del savedata, e uno AppDelegate.m:170: warning: method definition for '-dataTablePatch' not found aiuto! Macbook Unibody - 2.4 Ghz Intel Core Duo - 2GB 1067 MHZ DDR3 iPod Touch 2g - iPod Touch 4g Link al commento Condividi su altri siti Altre opzioni di condivisione...
bublen Inviato 1 Marzo 2011 Segnala Condividi Inviato 1 Marzo 2011 devi dichiarare le void nell'header Hai un'idea per un'app ma non sai programmare? Contattami. Trovi gli indirizzi sul mio sito: http://www.2ciphonedevelopers.com Link al commento Condividi su altri siti Altre opzioni di condivisione...
Sany Inviato 1 Marzo 2011 Autore Segnala Condividi Inviato 1 Marzo 2011 grazie ha funzionato, ora ho un altro problema, appena clicco un pulsante che mi dovrebbe cambiare la view esce: 2011-03-01 12:53:06.928 OS Sim[642:207] -[OS_SimAppDelegate tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x4b8ab00 2011-03-01 12:53:06.930 OS Sim[642:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OS_SimAppDelegate tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x4b8ab00' *** Call stack at first throw: ( 0 CoreFoundation 0x00fa8be9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x010fd5c2 objc_exception_throw + 47 2 CoreFoundation 0x00faa6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x00f1a366 ___forwarding___ + 966 4 CoreFoundation 0x00f19f22 _CF_forwarding_prep_0 + 50 5 UIKit 0x0047ef16 -[uISectionRowData refreshWithSection:tableView:tableViewRowData:] + 1834 6 UIKit 0x0047c9e7 -[uITableViewRowData numberOfRows] + 108 7 UIKit 0x003338c2 -[uITableView noteNumberOfRowsChanged] + 132 8 UIKit 0x003402b8 -[uITableView reloadData] + 773 9 UIKit 0x0033d470 -[uITableView layoutSubviews] + 42 10 QuartzCore 0x01c7b451 -[CALayer layoutSublayers] + 181 11 QuartzCore 0x01c7b17c CALayerLayoutIfNeeded + 220 12 QuartzCore 0x01c7437c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310 13 QuartzCore 0x01c740d0 _ZN2CA11Transaction6commitEv + 292 14 QuartzCore 0x01ca47d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99 15 CoreFoundation 0x00f89fbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27 16 CoreFoundation 0x00f1f0e7 __CFRunLoopDoObservers + 295 17 CoreFoundation 0x00ee7bd7 __CFRunLoopRun + 1575 18 CoreFoundation 0x00ee7240 CFRunLoopRunSpecific + 208 19 CoreFoundation 0x00ee7161 CFRunLoopRunInMode + 97 20 GraphicsServices 0x018dd268 GSEventRunModal + 217 21 GraphicsServices 0x018dd32d GSEventRun + 115 22 UIKit 0x002d542e UIApplicationMain + 1160 23 OS Sim 0x000022a4 main + 102 24 OS Sim 0x00002235 start + 53 25 ??? 0x00000001 0x0 + 1 ) terminate called after throwing an instance of 'NSException' Macbook Unibody - 2.4 Ghz Intel Core Duo - 2GB 1067 MHZ DDR3 iPod Touch 2g - iPod Touch 4g Link al commento Condividi su altri siti Altre opzioni di condivisione...
bublen Inviato 1 Marzo 2011 Segnala Condividi Inviato 1 Marzo 2011 a quanto pare non riconosce il numero delle righe nella tabella. probabilmente non ritorna un integer come dovrebbe. controlla il metodo numberOfRowsInSection. metti anche un log magari. se per esempio nel metodo hai return numero fai NSLog(@"%i", numero) e vedi che dice la console. probabilmente non tornerà nulla, altrimenti non avresti il problema. quindi o non "riesce" a leggere l'integer o non è un integer Hai un'idea per un'app ma non sai programmare? Contattami. Trovi gli indirizzi sul mio sito: http://www.2ciphonedevelopers.com Link al commento Condividi su altri siti Altre opzioni di condivisione...
Sany Inviato 1 Marzo 2011 Autore Segnala Condividi Inviato 1 Marzo 2011 -(NSInteger)numberOfSectionsinTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSections:(NSInteger)section { return [data count]; } Macbook Unibody - 2.4 Ghz Intel Core Duo - 2GB 1067 MHZ DDR3 iPod Touch 2g - iPod Touch 4g Link al commento Condividi su altri siti Altre opzioni di condivisione...
bublen Inviato 1 Marzo 2011 Segnala Condividi Inviato 1 Marzo 2011 cos'è data? se vuoi mandarmi un pezzo di codice per capirci qualcosa in più fallo... altrimenti non so molto che dirti la mia mail la trovi sul mio sito (in firma) Hai un'idea per un'app ma non sai programmare? Contattami. Trovi gli indirizzi sul mio sito: http://www.2ciphonedevelopers.com Link al commento Condividi su altri siti Altre opzioni di condivisione...
Sany Inviato 1 Marzo 2011 Autore Segnala Condividi Inviato 1 Marzo 2011 ho inviato l'@ ma scrivo cmq il codice anche qui: #import "OS_SimAppDelegate.h" @implementation OS_SimAppDelegate @synthesize window, viewController; #pragma mark - #pragma mark Application lifecycle /*- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [self.window makeKeyAndVisible]; return YES; }*/ -(IBAction)addRowToTableView{ [data addObject:tableCellText.text]; [self saveData]; [mainTableView reloadData]; } -(IBAction)editTable{ UIBarButtonItem *leftItem; [mainTableView setEditing:!mainTableView.editing animated:YES]; if (mainTableView.editing) { leftItem = [[uIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(editTable)]; } else { leftItem = [[uIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editTable)]; } navItem.rightBarButtonItem = leftItem; [self saveData]; [mainTableView reloadData]; } -(NSInteger)numberOfSectionsinTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSections:(NSInteger)section { return [data count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; if (cell == nil) { cell = [[[uITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"] autorelease]; } cell.textLabel.text = [data objectAtIndex:indexPath.row]; return cell; } -(NSString *)dataFilePath { NSString *dataFilePath; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentDirectory = [paths objectAtIndex:0]; dataFilePath = [[documentDirectory stringByAppendingPathComponent:@"applicationData.plist"] retain]; return dataFilePath; } -(IBAction)endText{ } - (void)applicationDidFinishLaunching:(UIApplication *)application { NSArray *archivedArray = [NSKeyedUnarchiver unarchiveObjectWithFile:[self dataFilePath]]; if (archivedArray == nil) { data = [[NSMutableArray alloc] init]; } else { data = [[NSMutableArray alloc] initWithArray:archivedArray]; } // Override point for customization after application launch [window addSubview:viewController.view]; [window makeKeyAndVisible]; } - (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, called instead of applicationWillTerminate: when the user quits. */ } - (void)applicationWillEnterForeground:(UIApplication *)application { /* Called as part of 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. See also applicationDidEnterBackground:. */ } #pragma mark - #pragma mark Memory management - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { /* Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. */ } -(void)saveData{ [NSKeyedArchiver archiveRootObject:[data copy] toFile:[self dataFilePath]]; } -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ [data removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath ] withRowAnimation:UITableViewRowAnimationLeft]; } - (void)dealloc { [viewController release]; [window release]; [super dealloc]; } @end Macbook Unibody - 2.4 Ghz Intel Core Duo - 2GB 1067 MHZ DDR3 iPod Touch 2g - iPod Touch 4g Link al commento Condividi su altri siti Altre opzioni di condivisione...
J_Ares Inviato 1 Marzo 2011 Segnala Condividi Inviato 1 Marzo 2011 -(NSInteger)tableView: (UITableView *)tableView numberOfRowsInSections: (NSInteger)section il nome del metodo è sbagliato... se implementi il protocollo delle tableviewdatasource non ha problemi perché controlli che tutti i metodo richiesti e necessari siano implementati il Mio Sito i miei software:--Dvd Hunter | Game Hunter | Book Hunter | Hunter Touch  MacBook Pro 15" i7  iMac Alu  iPod touch 4° Link al commento Condividi su altri siti Altre opzioni di condivisione...
Sany Inviato 1 Marzo 2011 Autore Segnala Condividi Inviato 1 Marzo 2011 ho corretto, ma non va lo stesso, nella console mi segna: -[OS_SimAppDelegate tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x4b37cb0 2011-03-01 18:11:38.532 OS Sim[2249:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OS_SimAppDelegate tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x4b37cb0' *** Call stack at first throw: però non so cosa non vada, sembra essere tutto giusto, -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } sono da poco (3 mesi) su xcode, e vengo da visual basic, ma è un po difficile per me, sul web ho trovato questo: http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDataSource_Protocol/Reference/Reference.html ma non ci capisco niente. quello che ho creato fino adesso, l'ho seguito da un video tutorial sul tubo. Macbook Unibody - 2.4 Ghz Intel Core Duo - 2GB 1067 MHZ DDR3 iPod Touch 2g - iPod Touch 4g Link al commento Condividi su altri siti Altre opzioni di condivisione...
Messaggi raccomandati
Archiviato
Questa discussione è archiviata e chiusa a future risposte.