nsdata

How to create a Objective C class for Buffer

I am getting buffer with its length in a function (void)putEncodedData:(void *)data ofSize:(unsigned)size I want to create a custom class for this buffer data with name AudioData with variables data,size . How to set its @property attribues ? Please help me. Thanks in advance ...

Inserting NSData into SQLite on the iPhone

Hi all, So far I've managed to create this method for inserting into a SQLite database on the iPhone: - (void) insertToDB :(NSString *)Identifier :(NSString *)Name { sqlite3 *database; if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { char *sql1 = "INSERT INTO table VALUES ('"; const cha...

iPhone: message sent to deallocated instance error

I have narrowed down this error (which crashes my app): -[NSConcreteMutableData release]: message sent to deallocated instance 0x6eaed40 to the following code: emailData = [kmlDoc dataUsingEncoding:NSUTF8StringEncoding]; But, I cannot figure out why this error is being caused? That line is just setting a very large string to an NS...

Referring to a sandbox file from HTML with iPhone

Hi, I'm trying to build a HTML based application for the iPad. I want to build a background process using Objective-C to download images and data and then refer to those from within a HTML file using the UIWebView. I can successfully download an image and save it to the Documents sandbox directory. In the simulator I can see the pat...

saving images to keep next time app is started for a tableview

I am developing an iPhone app that requires an image to be in a cell in a tableview. In the CNN App if you quit the app and then stop it in multitasking it keeps the images for the next time the app is started up. How do I do this for my app? ...

UIImage that came from UIImagePickerController's photo library, is white image

Hello, When get UIImage that came from UIImagePickerController's photo library, i get white image, why is that? tnx ...

Is NSMutableArray writeToFile recursive?

Does NSMutableArray support recursive serialization? E.g. will a NSMutableArray of NSMutableArray's serialize the entirety of the heirarchy out when calling writeToFile? Example: NSMutableArray *topArray = [[NSMutableArray alloc] init]; NSMutableArray *bottomArray = [[NSMutableArray alloc] init]; NSString *foo = @"foo"; NSString *bar...

converting data back into a string

So I have this: NSData *charlieSendData = [[charlieImputText stringValue] dataUsingEncoding:NSUTF8StringEncoding]; I know how to convert NSStrings to data but how I convert data back to an NSString? Elijah ...

Converting GIF images to nsdata

Hi all, I have an iPhone application that needs to save an image onto the database in BLOB format. The problem is that if the image is in .gif format then it cannot be converted to NSDATA format and hence i am not been able to save that onto the database in BLOB format. What should I do? Please help with some code.. Thanks in advance...

Getting data from the nstask - communicating with command line - objective c

I know how to send data to the task: NSData *charlieSendData = [[charlieImputText stringValue] dataUsingEncoding:NSUTF8StringEncoding]; [[[task standardInput] fileHandleForWriting] writeData:charlieSendData]; But how do I get what the task responds with?? Elijah ...

Resize NSData to set into UIImage

Hello everyone, I have these codes: UIImage * img = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:IMAGEURL]]]; [self.imageView setImage:img]; But the IMAGEURL contains a high resolution picture so it takes much time to load. Can I resize the image data smaller to load faster? Any help will be appre...

Generating a DTMF tone doesn't work - application crashes!

Hi, I want to generate a custom DTMF tone and play it on the iPhone. In order to do so, I have created and allocated a memory buffer with a custom tone (ptr). Now I want to create a NSData object, initialized with the memory buffer, and pass it to AVAudioPlayer using initWithData:error: instance method. I wrote the following code, but ...

Code problem - objective c - waiting for string value to appear in string value

task = [NSTask new]; [task setLaunchPath:@"/bin/sh"]; [task setArguments:[NSArray arrayWithObject:@"/applications/jarvis/brain/server.sh"]]; [task setCurrentDirectoryPath:@"/"]; NSPipe *outputPipe = [NSPipe pipe]; [task setStandardInput:[NSPipe pipe]]; [task setStandardOutput:outputPipe]; [task launch]; NSMutableString *outputString =...

NSData dataWithContentsOfURL cache

NSData +dataWithContentsOfURL has any kind of caching by default? Has anyone experimented some kind of problems using this method, what is the most efficient way to get Data from the web? ...

Using an NSString and UIImageView to load image from URL, failing on some URLs

I've got some code to load an image from a URL, it seems to work ok. Unless the URL contains curly brackets. This seems like it is a string formatting problem? I can't figure it out. ex @"http://site/image.png //works @"http://site/{image}.png //doesn't work NSString* mapURL = @"http://site.com/directory/{map}.png"; NSLo...

Write NSData to a file ???

I am trying to write an nsdata to a file on my disk, I have the following code and it doesn't work, am i doing anything wrong? Boolean result = [data writeToFile:@"/Users/aryaxt/Desktop/test2.avi" atomically:YES]; test2.avi doesn't exist, I am assuming that writeToFile would create it for me ...

How to get a plist data from URL to NSArray ?

Here is my code it looks ok But it crash when running NSString *urlAddress = [NSString stringWithFormat:@"http://www....php"]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:urlAddress]]; [request setHTTPMethod:@"GET"]; NSData *returnData = [NSURLConnection sen...

Loading BLOB objects into an array in iPhone

Hello Everyone, I need to populate an array with BLOB type data retrived from SQLite DB.At present i am using NSData to display the image,but i want to put the image in an array and display it in the UITableView How can i do this,please help me ...

Logging in a text file iPhone

Hi, I have a score system and I would like to log all scores in a text file separated by line breaks. Here is my current save code: NSData *dataToWrite = [[NSString stringWithFormat:@"String to write ID:%i \n",random] dataUsingEncoding:NSUTF8StringEncoding]; NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDir...

Does all data from URL get loaded into NSData at initialization?

What exactly happens when I do this...? NSData *data = [[NSData alloc] initWithContentsOfURL:[NSURL urlWithString:@"..."]]; Does it immediately go out to the Internet, gets all the data at the URL, returns, and goes to the next line? Or does it set things up, and the data is read later when the bytes of NSData are requested? If the d...