nsdata

How do I upload an NSImage(NSData)to Twitpic with OAMutableURLRequest?

I'm using OAConsumer in my xAuth twitterEngine and i'm adding Twitpic OAuth Echo to it. But it won't POST the NSData. here is some of my code: //other file NSArray *reps = [[imageToUpload image] representations]; NSData *imageData = [NSBitmapImageRep representationOfImageRepsInArray:reps usingType:NSJP...

Split NSData objects into other NSData objects with a given size

I'm having an NSData object of approximately 1000kb big. Now I want to transfer this via bluetooth. This would be better if I have let's say 10 objects of 100kb. It comes to mind that I should use the -subdataWithRange: method of NSData. I haven't really worked with NSRange. Well I know how it works, but then to read from a given locati...

Problem getting size of Website Xcode

When i try and compile I come up with a warning that reads initialization makes pointer from integer without a cast. No clue why. I am just trying to get the size of a website. #import "Lockerz_RedemptionViewController.h" @implementation Lockerz_RedemptionViewController -(IBAction)startLoop:(id) sender { NSData *dataNew = [NSDat...

UITableView - Loading data from internet

Hey. I have seen many apps that load data to UITableViews from the internet, and they usually load smoothly. Now it's my turn to load in that kind of data. I am getting different data at the same time, separating categories with ~ and pieces of categories with #. This works great, and I have managed to separate the data in obj-c perfect...

Cocoa & Cocoa Touch. How do I create an NSData object from a plain ole pointer?

I have malloc'd a whole mess of data in an NSOperation instance. I have a pointer: data = malloc(humungous_amounts_of_god_knows_what); uint8_t* data; How do I package this up as an NSData instance and return it to the main thread? I am assuming that after conversion to an NSData instance I can simply call: free(data); Yes? Also, b...

nsdata to nsstring to nsdata

Hello everybody. I am calling the webservices. The web service returns data in xml format. Now the problem is the xml data is not being received in proper format. In place of "<", ">" it returns in html form . So i assigned the xmldata to a NsMutableString and replaced the escape characters so that the format of xml data is proper. Then ...

Have NSXMLParser parse the contents of multiple URLs at once

I've been using NSXMLParser on the iPhone to parse out XML files from the web without any problems. I'm now in a situation though where I want to get the contents of three different URLs and then parse them all at once. I'm doing this by creating three NSMutableData instances, each filled with the contents of one of the three URLs. I'm ...

getting plist from documents directory instead of Bundle

I'm trying to point to the documents directory instead of the Bundle, I have the following code: - (id)initWithLibraryName:(NSString *)libraryName { if (self = [super init]) { libraryPlist = libraryName; libraryContent = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] ...

leaks when using NSData, NSURL,NSMutableURLRequest,NSURLConnection and sendSynchronousRequest

Hi Guys, I am getting the leak at this line in below code" NSData *returnData = [NSURLConnection ..........." NSURL *finalURL = [NSURL URLWithString:curl]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:finalURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:...

Play video in UIWebView from NSData

Hello there, Does anybody know how to play a video in a UIVebView ? The video comes from the iphone library, when I pick it, I store it in core data as binary data. If i use the local url of the video it's working fine, the problem I have is that the this url refers to a folder named "tmp", and I don't know the lifetime of it. If I ca...

Does -dataWithContentsOfURL: of NSData work in a background thread?

Does -dataWithContentsOfURL: of NSData work in a background thread? ...

Problem while converting NSData to int

Using foundation and cocoa frameworks on Mac, I am trying to convert an NSData object in humanly understandable number. Let say the NSData object is an image of NPIXEL. I know the binary data are coded in big endian and represent 32 bit integer (to be more precise 32 bit two complements integer). I write the piece of code bellow to conve...

Converting NSData to Java float?

So I'm writing an application for my iphone that networks to my computer running a java application using a socket. But when I'm transferring data, I have to send a NSData object from my iphone, and of course the java program doesn't know how to interpret it. How can I fix this? I need to send 3 float values between the two applications....

How to load an external php or html file into a section in my iPhone app

Trying to figure out how to load an external webpage into my iPhone app. It would be used to let people know the latest of something. Here's what I have found but I am unaware of how to use it: NSData *externalData = [NSData dataWithContentsOfURL:[NSURL URLWithString: @"http"//www.xprogress.com/time.php"]] How would I load this into...

How to Create UIImage from NSData and Avatar Data of XMPP?

Hi, This question is related to Iphone SDK, NSData and UIImage. I am trying to create an image from the Avatar Data returned from the xmpp like the following: <presence from='[email protected]/spark' to='[email protected]/424978324712783686768453' id='Oj02v-45'><status>Away due to idle.</status><priority>0</priority><show>away</show><x...

How to create UIIMage from Hex Data?

Hi, I am using XMPP and XMPP will give me a photo data like the following: a3f549fa9705e7ead2905de0b6a804227ecdd404 So I assume the above data is the photo data and I assume that it's Hex data. (maybe I am wrong) So I use the following to create the UIImage, but it doesn't work anyone know how to do it? What I am trying to do is to ch...

Set Text in NSTextView with NSData

Hi folks! I have an instance of NSData that I stored from a previous run of my application. I want to set an NSTextView's text using this data. It is RTF and I can't figure out how to do this. Any ideas or suggestions? It needs to be done with code and not Interface Builder. Thanks ...

receiveData not called corresponding to all sendData mthod

I am developing a chat application using bluetooth.Initially i was sending text only and was receiving it correctly. NSData *mydata=[str dataUsingEncoding:NSUTF8StringEncoding]; [self sendPacket:mydata ofType:0]; -(void) sendPacket:(NSData*)data ofType:(PacketType)type { NSMutableData * newPacket = [NSMutableData dataWithCapacity:([d...

Create NSData object with hex data

Hi there, I have a hex set of data, ripped from a .plist save of an NSArray, that reads (for example) like this: 06000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00010000 08020100 00000000 e028f440 00008543 00809343 b0e22a00 that I would like to turn into an NSData object. What is the appropriate way to do this...

dataWithContentsOfURL is painfully slow

I have a SQLite dbase that has over 100 URLs for images. The images are NOT displayed in the tableview, however when a row in the tableview is selected, the appropriate image is displayed in the 'pushed' view controller. The problem is whenever a row is selected, the app freezes for a time until the view controller is finally pushed. I ...