Search Results

Search found 30 results on 2 pages for 'zp26'.

Page 1/2 | 1 2  | Next Page >

  • Append data to file in iPhone app

    - by zp26
    I have a problem. I want to create a file like XML. I have create a code for this but the file not append the information but rewrite and save only the last NSData. Can you help me/ This is my code -(void)salvataggioInXML:(NSString*)name:(float)x:(float)y:(float)z{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectoryPath stringByAppendingPathComponent:@"filePosizioni.xml"]; NSFileHandle *myHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath]; [myHandle seekToEndOfFile]; NSString *tagName = [NSString stringWithFormat:@"<name>%@<name>", name]; NSString *tagX = [NSString stringWithFormat:@"<x>%f<x>", name]; NSString *tagY = [NSString stringWithFormat:@"<y>%f<y>", name]; NSString *tagZ = [NSString stringWithFormat:@"<z>%f<z>", name]; NSData* dataName = [tagName dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataX = [tagX dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataY = [tagY dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataZ = [tagZ dataUsingEncoding: NSASCIIStringEncoding]; if ([dataName writeToFile:filePath atomically:YES]) NSLog(@"writeok"); [myHandle seekToEndOfFile]; if ([dataX writeToFile:filePath atomically:YES]) NSLog(@"writeok"); [myHandle seekToEndOfFile]; if ([dataY writeToFile:filePath atomically:YES]) NSLog(@"writeok"); [myHandle seekToEndOfFile]; if ([dataZ writeToFile:filePath atomically:YES]) NSLog(@"writeok"); [myHandle seekToEndOfFile]; NSLog(@"zp26 %@",filePath); }

    Read the article

  • Problem with writeData

    - by zp26
    Hi, I have a problem with my code. I want to create a XML file like this: <name>myName<name> <x>myX<x> <y>myY<y> <z>myZ<z> but my file is: <name>myName<name><x>myX<x><y>myY<y><z>myZ<z> Can i have this text formatting? This is my code: -(void)salvataggioInXML:(NSString*)name:(float)x:(float)y:(float)z{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectoryPath stringByAppendingPathComponent:@"filePosizioni.xml"]; NSFileHandle *myHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath]; [myHandle seekToEndOfFile]; NSString *tagName = [NSString stringWithFormat:@"<name>%@<name>", name]; NSString *tagX = [NSString stringWithFormat:@"<x>%f<x>", name]; NSString *tagY = [NSString stringWithFormat:@"<y>%f<y>", name]; NSString *tagZ = [NSString stringWithFormat:@"<z>%f<z>", name]; NSData* dataName = [tagName dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataX = [tagX dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataY = [tagY dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataZ = [tagZ dataUsingEncoding: NSASCIIStringEncoding]; [myHandle writeData:dataName]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataX]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataY]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataZ]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; NSLog(@"zp26 %@",filePath); }

    Read the article

  • Save file in a different location in iPhone App

    - by zp26
    Hi, I have a problem. My proget create a xml file. In the iPhone this file was store in the NSDocumentDirectory. I wanna save this file in another directory like Desktop(where there are the apps) or another visible folder. Thanks. This is my code: -(void)saveInXML:(NSString*)name:(float)x:(float)y:(float)z{ //NSDocumentDirectory put the file in the app directory NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectoryPath stringByAppendingPathComponent:@"filePosizioni.xml"]; NSFileHandle *myHandle; NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *titoloXML = [NSString stringWithFormat:@"File Xml delle posizioni del iPhone"]; NSString *inizioTag = [NSString stringWithFormat:@"\n\n\n<posizione>"]; NSString *tagName = [NSString stringWithFormat:@"\n <name>%@</name>", name]; NSString *tagX = [NSString stringWithFormat:@"\n <x>%f</x>", x]; NSString *tagY = [NSString stringWithFormat:@"\n <y>%f</y>", y]; NSString *tagZ = [NSString stringWithFormat:@"\n <z>%f</z>", z]; NSString *fineTag= [NSString stringWithFormat:@"\n</posizione>"]; NSData* dataTitoloXML = [titoloXML dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataInizioTag = [inizioTag dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataName = [tagName dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataX = [tagX dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataY = [tagY dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataZ = [tagZ dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataFineTag = [fineTag dataUsingEncoding: NSASCIIStringEncoding]; if(![fileManager fileExistsAtPath:filePath]) [fileManager createFileAtPath:filePath contents:dataTitoloXML attributes:nil]; myHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath]; [myHandle seekToEndOfFile]; [myHandle writeData:dataInizioTag]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataName]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataX]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataY]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataZ]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataFineTag]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; NSLog(@"zp26 %@",filePath); }

    Read the article

  • Problem with parsing XML with iPhone app

    - by zp26
    Hi, I have a problem with a xml parsing. I have create a class for parsing. The xmlURL is correct (testing it from debug) but when i call the method parse the variable success become FALSE and a errorParsing is "NSXMLParserErrorDomain". Can you help me? My code is below. #import "xmlParser.h" #import"Posizione.h" @implementation xmlParser @synthesize arrayPosizioniXML; NSString *tempString; Posizione *posizioneRilevata; - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if([tempString isEqualToString:@"name"]) posizioneRilevata.nome = string; else if([tempString isEqualToString:@"x"]) posizioneRilevata.valueX = [string floatValue]; else if([tempString isEqualToString:@"y"]) posizioneRilevata.valueY = [string floatValue]; else if([tempString isEqualToString:@"z"]) posizioneRilevata.valueZ = [string floatValue]; else if([tempString isEqualToString:@"/posizione"]) [arrayPosizioniXML addObject:posizioneRilevata]; } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { //[textArea setText:[[NSString alloc] initWithFormat:@"%@\nFine elemento: %@",textArea.text,elementName]]; } - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict { if ([elementName isEqualToString:@"name"]){ tempString = @"name"; NSLog(@"ok"); } else if([elementName isEqualToString:@"x"]){ tempString = @"x"; } else if([elementName isEqualToString:@"y"]) { tempString = @"y"; } else if([elementName isEqualToString:@"z"]) { tempString = @"z"; } else if([elementName isEqualToString:@"/posizione"]) { tempString = @"/posizione"; } } -(BOOL)avviaParsing{ //Bisogna convertire il file in una NSURL altrimenti non funziona NSLog(@"zp26 %@",path); NSURL *xmlURL = [NSURL fileURLWithPath:path]; // Creiamo il parser NSXMLParser *parser = [[ NSXMLParser alloc] initWithContentsOfURL:xmlURL]; // Il delegato del parser e' la classe stessa (self) [parser setDelegate:self]; //Effettuiamo il parser BOOL success = [parser parse]; //controlliamo come è andata l'operazione if(success == YES){ //parsing corretto return TRUE; } else { NSError *errorParsing = [[NSError alloc]init]; errorParsing = [parser parserError]; //c'è stato qualche errore... return FALSE; } // Rilasciamo l'oggetto NSXMLParser [parser release]; } -(id)init { self = [super init]; if (self != nil) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; path = [documentsDirectoryPath stringByAppendingPathComponent:@"filePosizioni.xml"]; posizioneRilevata = [[Posizione alloc]init]; tempString = [[NSString alloc]init]; } return self; } @end @implementation AccelerometroViewController -(BOOL)caricamentoXML{ xmlParser *parser; parser = [[xmlParser alloc]init]; if([parser avviaParsing]){ [arrayPosizioni addObjectsFromArray:parser.arrayPosizioniXML]; return TRUE; } else return FALSE; } - (void)viewDidLoad { [super viewDidLoad]; if([self caricamentoXML]){ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Caricamento Posizioni da Xml" message:@"Posizione caricata con successo" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } else{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Caricamento Posizioni da Xml" message:@"Posizione non caricate" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } } @end

    Read the article

  • Problem with XML parser

    - by zp26
    Hi, I have a problem with parsing XML. I have created a program which write a file xml in the project directory. The file XML are correct. (i checked). When i try to read this XML the program crash and return 1 status. I have controlled my 2 path and they are equals. Can you help me please? Thanks so much. #import "PositionIdentifierViewController.h" #import "WriterXML.h" @implementation PositionIdentifierViewController - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { NSString *stringa = [NSString stringWithFormat:@"%@",string]; textArea.text = [textArea.text stringByAppendingString:@"\n"]; textArea.text = [textArea.text stringByAppendingString:stringa]; } -(IBAction)startParsing { NSURL *xmlURL = [NSURL fileURLWithPath:path]; NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL]; [parser setDelegate:self]; BOOL success = [parser parse]; if(success == YES){ // } [parser release]; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; NSArray *tempPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [tempPaths objectAtIndex:0]; path = [documentsDirectoryPath stringByAppendingPathComponent:@"filePosizioni.xml"]; WriterXML *newWriter; newWriter = [[WriterXML alloc]init]; [newWriter saveXML:(NSString*)@"ciao":(float)10:(float)40:(float)70]; [newWriter saveXML:(NSString*)@"pippo":(float)20:(float)50:(float)80]; [newWriter saveXML:(NSString*)@"pluto":(float)30:(float)60:(float)90]; NSLog(path); } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end #import "WriterXML.h" @implementation WriterXML -(void)saveXML:(NSString*)name:(float)x:(float)y:(float)z{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectoryPath stringByAppendingPathComponent:@"filePosizioni.xml"]; NSFileHandle *myHandle; NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *titoloXML = [NSString stringWithFormat:@"<?xml version=1.0 encoding=UTF-8 ?>"]; NSString *inizioTag = [NSString stringWithFormat:@"\n\n\n<position>"]; NSString *tagName = [NSString stringWithFormat:@"\n <name>%@</name>", name]; NSString *tagX = [NSString stringWithFormat:@"\n <x>%f</x>", x]; NSString *tagY = [NSString stringWithFormat:@"\n <y>%f</y>", y]; NSString *tagZ = [NSString stringWithFormat:@"\n <z>%f</z>", z]; NSString *fineTag= [NSString stringWithFormat:@"\n</position>"]; NSData* dataTitoloXML = [titoloXML dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataInizioTag = [inizioTag dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataName = [tagName dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataX = [tagX dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataY = [tagY dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataZ = [tagZ dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataFineTag = [fineTag dataUsingEncoding: NSASCIIStringEncoding]; if(![fileManager fileExistsAtPath:filePath]) [fileManager createFileAtPath:filePath contents:dataTitoloXML attributes:nil]; myHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath]; [myHandle seekToEndOfFile]; [myHandle writeData:dataInizioTag]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataName]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataX]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataY]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataZ]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataFineTag]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; NSLog(@"zp26 %@",filePath); } @end

    Read the article

  • while(1) block my recv thread

    - by zp26
    Hello. I have a problem with this code. As you can see a launch with an internal thread recv so that the program is blocked pending a given but will continue its execution, leaving the task to lock the thread. My program would continue to receive the recv data socket new_sd and so I entered an infinite loop (the commented code). The problem is that by entering the while (1) my program block before recv, but not inserting it correctly receives a string, but after that stop. Someone could help me make my recv always waiting for information? Thanks in advance for your help. -(IBAction)Chat{ [NSThread detachNewThreadSelector:@selector(riceviDatiServer) toTarget:self withObject:nil]; } -(void)riceviDatiServer{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; labelRicevuti.text = [[NSString alloc] initWithFormat:@"In attesa di ricevere i dati"]; char datiRicevuti[500]; int ricevuti; //while(1){ ricevuti = recv(new_sd, &datiRicevuti, 500, 0); labelRicevuti.text = [[NSString alloc] initWithFormat:@"%s", datiRicevuti]; //} [pool release]; }

    Read the article

  • KissXml on iPhone

    - by zp26
    Hi, I have dowload a KissXml project. I must add all the files to my project (excluding DDXMLTesting). Sorry for the stupid question but i must insert all class in the classes folder (http://ixhan.com/2010/03/tutorial-of-kissxml-iphone/) or i can do another operation. Sorry but i'm a beginner programmer for iPhone.

    Read the article

  • Problem with saveToFile

    - by zp26
    Hi, I have a problem with a NSData writeToFile. I have implemented the code below but i have an anomaly. When i run my program on the simulator, the new file is created and the informations are stored; when i build the app in my device , the file isn't created. The debug don't give me any error but don/t save anything. Can you help me? Thanks so much and sorry for my english. -(void)saveXML:(NSString*)name:(float)x:(float)y:(float)z{ NSMutableData *data = [NSMutableData data]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]; [archiver setOutputFormat:NSPropertyListXMLFormat_v1_0]; [archiver encodeFloat:x forKey:@"x"]; [archiver encodeFloat:y forKey:@"y"]; [archiver encodeFloat:z forKey:@"z"]; [archiver encodeObject:name forKey:@"name"]; [archiver finishEncoding]; BOOL result = [data writeToFile:@"XML Position" atomically:YES]; if(result) [self updateTextView:@"success"]; [archiver release]; }

    Read the article

  • I want close a CFSocket

    - by zp26
    Hi, I have create a socket with CFSocket. My program is correct but now i wanna close the socket (client side). There is a istruction? Thanks and sorry for my English XP My code: CFSocketRef s; s = CFSocketCreate( NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP, kCFSocketDataCallBack, AcceptDataCallback, &context); ... CFSocketConnectToAddress(s, address, 0); ... //here i wanna close the socket

    Read the article

  • Problem with NSMutableArray

    - by zp26
    Hi, I have a problem with NSMutableArray. In my program i have a lot of variabile "CFSocketRef". i want to save this in NSMutableArray but i can't. Can you help me? Thank and sorry for my english XP My code: CFSocketRef socketAccept; NSMutableArray *arrayIP = [[NSMutableArray alloc] init]; self.socketAccept = CFSocketCreateWithNative(NULL, fd, kCFSocketDataCallBack, AcceptDataCallback, &context); [arrayIP addObject:(id)self.socketAccept];

    Read the article

  • Insert a tag with NSFileHandle

    - by zp26
    Hi, I want insert a tag in the Xml file. I have NSFileHandle object and i know the "offsetInFile" and the "seekToFileOffset:" methods but i don't know how to use. I have the Xml below and i want insert a tag between "positions" and "/positions" tag. Thanks so much. <?xml version=1.0 encoding=UTF-8 ?> <positions> //I want insert in this position my tag with the NSFileHandle. </positions>

    Read the article

  • Problem with close socket

    - by zp26
    Hi, I have a problem with my socket program. I create the client program (my code is below) I have a problem when i close the socket with the disconnect method. Can i help me? Thanks and sorry for my English XP CFSocketRef s; -(void)CreaConnessione { CFSocketError errore; struct sockaddr_in sin; CFDataRef address; CFRunLoopSourceRef source; CFSocketContext context = { 0, self, NULL, NULL, NULL }; s = CFSocketCreate( NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP, kCFSocketDataCallBack, AcceptDataCallback, &context); memset(&sin, 0, sizeof(sin)); int port = [fieldPorta.text intValue]; NSString *tempIp = fieldIndirizzo.text; const char *ip = [tempIp UTF8String]; sin.sin_family = AF_INET; sin.sin_port = htons(port); sin.sin_addr.s_addr = (long)inet_addr(ip); address = CFDataCreate(NULL, (UInt8 *)&sin, sizeof(sin)); errore = CFSocketConnectToAddress(s, address, 0); if(errore == 0){ buttonInvioMess.enabled = TRUE; fieldMessaggioInvio.enabled = TRUE; labelTemp.text = [NSString stringWithFormat:@"Connesso al Server"]; CFRelease(address); source = CFSocketCreateRunLoopSource(NULL, s, 0); CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode); CFRelease(source); CFRunLoopRun(); } else{ labelTemp.text = [NSString stringWithFormat:@"Errore di connessione. Verificare Ip e Porta"]; switchConnection.on = FALSE; } } //the socket doesn't disconnect -(void)Disconnetti{ CFSocketInvalidate(s); CFRelease(s); } -(IBAction)Connetti { if(switchConnection.on) [self CreaConnessione]; else [self Disconnetti]; }

    Read the article

  • My Thread Programs Crash

    - by zp26
    I have a problem with threads objectiveC. The line of code below contains the recv block the program waiting for a datum. My intention is to launch a thread parallel to the program so that this statement does not block any application. I put this code in my program but when active switch the program crashes. Enter the code. -(IBAction)Chat{ if(switchChat.on){ buttonInvio.enabled = TRUE; fieldInvio.enabled = TRUE; [NSThread detachNewThreadSelector:@selector(riceviDatiServer) toTarget:self withObject:nil]; } else { buttonInvio.enabled = FALSE; fieldInvio.enabled = FALSE; } -(void)riceviDatiServer{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; int ricevuti; NSString *datiRicevuti; ricevuti = recv(temp, &datiRicevuti, datiRicevuti.length, 0); labelRicezione.text = [[NSString alloc] initWithFormat:@"%s.... %d", datiRicevuti, ricevuti]; [pool release]; }

    Read the article

  • Initialization problem

    - by zp26
    I have a problem. This is my code. When i try to use the IBAction SavePosition the "arrayPosition" isn't update. Else if i initialize the "arrayPosition" in "SavePosition" the value is stored in the array. Why this anomaly? #import <UIKit/UIKit.h> @interface AccelerometroViewController : UIViewController <UIAccelerometerDelegate, UITextFieldDelegate, UIAlertViewDelegate>{ //..... NSMutableArray *arrayPosizioni; NSMutableArray *arrayPosizioniCorrenti; NSString *nomePosizioneCorrente; } -(IBAction)salvaPosizione; //... @property (nonatomic, assign) NSMutableArray *arrayPosizioni; @property (nonatomic, assign) NSMutableArray *arrayPosizioniCorrenti; @property (nonatomic, assign) NSString *nomePosizioneCorrente; @end #import "AccelerometroViewController.h" #import "Position.h" @implementation AccelerometroViewController float actualX; float actualY; float actualZ; @synthesize arrayPosition; @synthesize arrayCurrentPosition; @synthesize nameCurrentPosition; -(id)init { self = [super init]; if (self != nil) { arrayPosition = [[NSMutableArray alloc]init]; arrayCurrentPosition = [[NSMutableArray alloc]init]; nameCurrentPosition = [NSString stringWithFormat:@"noPosition"]; actualX = 0; actualY = 0; actualZ = 0; } return self; } -(void)updateTextView:(NSString*)nomePosizione { NSString *string = [NSString stringWithFormat:@"%@", nameCurrentPosition]; textEvent.text = [textEvent.text stringByAppendingString:@"\n"]; textEvent.text = [textEvent.text stringByAppendingString:string]; } -(IBAction)savePosition{ Posizione *newPosition; newPosition = [[Position alloc]init]; if([newPosition setValue:(NSString*)fieldNomePosizione.text:(float)actualX:(float)actualY:(float)actualZ]){ //setValue is a method of Position. I'm sure that this method is correct UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Salvataggio Posizione" message:@"Posizione salvata con successo" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; [arrayPosition addObject:newPosition]; } else{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Salvataggio osizione" message:@"Errore nel salvataggio" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } }

    Read the article

  • Permits in iPhone apps

    - by zp26
    HI, I want to create i file in the iPhone application. I try it but i have a anomaly. In my pc the file is correctly written. In other pc with the same program the file wasn't exist. In the iPhone device the file not exist. But the strange think thing is that i haven't any error for the app in the all case. Do you have a idea? Thanks so much

    Read the article

  • probelem with NSTimer

    - by zp26
    Hi I have a problem with a NSTimer I recived a "SIGABRT" error and "[NSCFTimer intValue]: unrecognized selector sent to instance " These is my code: -(void)detectionMove:(NSNumber*)arrayIndex{ static BOOL notFind = FALSE; static int countVariable = 0; static int countRilevamenti = 0; notFind = FALSE; for(int i = countVariable+1; i<[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]count]; i++){ if(!notFind){ if((actualAccelerometerX+sensibilityMovement) >= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueX] && (actualAccelerometerX-sensibilityMovement) <= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueX] && (actualAccelerometerY+sensibilityMovement) >= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueY] && (actualAccelerometerY-sensibilityMovement) <= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueY] && (actualAccelerometerZ+sensibilityMovement) >= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueZ] && (actualAccelerometerZ-sensibilityMovement) <= [[[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]objectAtIndex:i]valueZ]) { countVariable = i; notFind = TRUE; countRilevamenti++; } } } if(!notFind) return; else if(countVariable+1 == [[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]count]){ if(countRilevamenti + tollerance >= [[[[sharedController arrayMovement]objectAtIndex:[arrayIndex intValue]] arrayPositionMove]count]) movementDetected = [arrayIndex intValue]; else NSLog(@"troppo veloce"); countVariable = 0; notFind = FALSE; countRilevamenti = 0; return; } [NSTimer scheduledTimerWithTimeInterval:timeToCatch target:self selector:@selector(detectionMove:) userInfo:(NSNumber*)arrayIndex repeats:NO]; }

    Read the article

  • problem with kCFSocketReadCallBack

    - by zp26
    Hello. I have a problem with my program. I created a socket with "kCFSocketReadCallBack. My intention was to call the "acceptCallback" only when it receives a string to the socket. Instead my program does not just accept the connection always goes into "startReceive" stop doing so and sometimes crash the program. Can anybody help? Thanks readSocket = CFSocketCreateWithNative( NULL, fd, kCFSocketReadCallBack, AcceptCallback, &context ); static void AcceptCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info) // Called by CFSocket when someone connects to our listening socket. // This implementation just bounces the request up to Objective-C. { ServerVistaController * obj; #pragma unused(address) // assert(address == NULL); assert(data != NULL); obj = (ServerVistaController *) info; assert(obj != nil); #pragma unused(s) assert(s == obj->listeningSocket); if (type & kCFSocketAcceptCallBack){ [obj acceptConnection:*(int *)data]; } if (type & kCFSocketAcceptCallBack){ [obj startReceive:*(int *)data]; } } -(void)startReceive:(int)fd { CFReadStreamRef readStream = NULL; CFIndex bytes; UInt8 buffer[MAXLENGTH]; CFStreamCreatePairWithSocket( kCFAllocatorDefault, fd, &readStream, NULL); if(!readStream){ close(fd); [self updateLabel:@"No readStream"]; } CFReadStreamOpen(readStream); [self updateLabel:@"OpenStream"]; bytes = CFReadStreamRead( readStream, buffer, sizeof(buffer)); if (bytes < 0) { [self updateLabel:(NSString*)buffer]; close(fd); } CFReadStreamClose(readStream); }

    Read the article

  • Looking for the log file on iPhone

    - by zp26
    Hi, I have a problem. I have the code below for save a data on file. I build my app on the device, and run. The result variable is TRUE, but i don't find the file on the my iPhone device. Can you help me? Thank and sorry for my english XP -(void)saveXML:(NSString*)name:(float)x:(float)y:(float)z{ NSMutableData *data = [NSMutableData data]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]; [archiver setOutputFormat:NSPropertyListXMLFormat_v1_0]; [archiver encodeFloat:x forKey:@"x"]; [archiver encodeFloat:y forKey:@"y"]; [archiver encodeFloat:z forKey:@"z"]; [archiver encodeObject:name forKey:@"name"]; [archiver finishEncoding]; NSString* filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"XML Position"]; BOOL result = [data writeToFile:filePath atomically:YES]; if(result) [self updateTextView:@"success"]; [archiver release]; }

    Read the article

  • Certificate in iPhone App

    - by zp26
    Hi, I'm working with iphone application and i want put it in my iphone. In xcode there is a overview "device - 3.1.3 | debug" but when i "build and go" the project there is an certificate error. I have download a certificate "mobileprovision" with a correct "Identifier" but i don't know how put it in my xcode project. Thanks and sorry for my english XP

    Read the article

  • libxml2 or NSXMLDocument for create a XML

    - by zp26
    Hi, I have a question for my iPhone app. I looking for a documentation for libxml2. I have find more example for reading by XML, but my program must create a XML and i don't find anything (example or tutorial) for this. I can create a XML with libxml2 or i must use NSXMLDocument? Can you take me a example? Thanks so much.

    Read the article

  • @ManyToMany Duplicate Entry Exception

    - by zp26
    I have mapped a bidirectional many-to-many exception between the entities Course and Trainee in the following manner: Course { ... private Collection<Trainee> students; ... @ManyToMany(targetEntity = lesson.domain.Trainee.class, cascade = {CascadeType.All}, fetch = {FetchType.EAGER}) @Jointable(name="COURSE_TRAINEE", joincolumns = @JoinColumn(name="COURSE_ID"), inverseJoinColumns = @JoinColumn(name = "TRAINEE_ID")) @CollectionOfElements public Collection<Trainee> getStudents() { return students; } ... } Trainee { ... private Collection<Course> authCourses; ... @ManyToMany(cascade = {CascadeType.All}, fetch = {FetchType.EAGER}, mappedBy = "students", targetEntity = lesson.domain.Course.class) @CollectionOfElements public Collection<Course> getAuthCourses() { return authCourses; } ... } Instead of creating a table where the Primary Key is made of the two foreign keys (imported from the table of the related two entities), the system generates the table "COURSE_TRAINEE" with the following schema: I am working on MySQL 5.1 and my App. Server is JBoss 5.1. Does anyone guess why?

    Read the article

  • intialization with a nibFIle failed

    - by zp26
    Hi, I have a problem. I try to initialize a variabile in a classViewController created inside a xib file. I try with the code below but when i append a object to array, these array isn't initialized. Can you help me? thanks and sorry for my english. #import <UIKit/UIKit.h> @interface AccelerometroViewController : UIViewController <UIAccelerometerDelegate, UITextFieldDelegate, UIAlertViewDelegate>{ //..... NSMutableArray *arrayPosizioni; NSMutableArray *arrayPosizioniCorrenti; NSString *nomePosizioneCorrente; } -(IBAction)salvaPosizione; //... @property (nonatomic, assign) NSMutableArray *arrayPosizioni; @property (nonatomic, assign) NSMutableArray *arrayPosizioniCorrenti; @property (nonatomic, assign) NSString *nomePosizioneCorrente; @end #import "AccelerometroViewController.h" #import "Position.h" @implementation AccelerometroViewController float actualX; float actualY; float actualZ; @synthesize arrayPosition; @synthesize arrayCurrentPosition; @synthesize nameCurrentPosition; -(id)init { self = [super init]; if (self != nil) { arrayPosition = [[NSMutableArray alloc]init]; arrayCurrentPosition = [[NSMutableArray alloc]init]; nameCurrentPosition = [NSString stringWithFormat:@"noPosition"]; actualX = 0; actualY = 0; actualZ = 0; } return self; } -(void)updateTextView:(NSString*)nomePosizione { NSString *string = [NSString stringWithFormat:@"%@", nameCurrentPosition]; textEvent.text = [textEvent.text stringByAppendingString:@"\n"]; textEvent.text = [textEvent.text stringByAppendingString:string]; } -(IBAction)savePosition{ Posizione *newPosition; newPosition = [[Position alloc]init]; if([newPosition setValue:(NSString*)fieldNomePosizione.text:(float)actualX:(float)actualY:(float)actualZ]){ //setValue is a method of Position. I'm sure that this method is correct UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Salvataggio Posizione" message:@"Posizione salvata con successo" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; [arrayPosition addObject:newPosition]; } else{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Salvataggio osizione" message:@"Errore nel salvataggio" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } } - (void) initialise { arrayPosition = [[NSMutableArray alloc] init]; arrayCurrentPosition = [[NSMutableArray alloc] init]; nameCurrentPosition = @"noPosition"; actualX = 0; actualY = 0; actualZ = 0; } - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { if (self = [super initWithNibName:nibName bundle:bundle]) { [self initialise]; } }

    Read the article

  • Error of iPhone certificate

    - by zp26
    Hi, I have a big problem. I have downloed a certificate from apple site. When I put it into xCode have a warning : "A valid signing identity matching this profile could not be found in your keychain" and can't build the app. Thanks and sorry for my English XP

    Read the article

  • Convert a NSString

    - by zp26
    My situation is explained in the code below. I need to send via a socket NSString drawn from a TextBox Thank you very much NSString *string = fieldTesto.txt; // I Find an istruction for insert s string in to the CFSocketSend UInt8 message[] = "Hello world"; CFDataRef data = CFDataCreate(NULL, message, sizeof(message)); CFSocketSendData(s, NULL, data, 0); CFRelease(data);

    Read the article

1 2  | Next Page >