iPhone using NSURLConnection to get multipart data is not working right - iphone

It seems that there is a bug in the NSURLconnection when you are getting multipart files, didReceiveResponse doesn't get called like the docs say between each part (see this). So I think I'm going to parse all of the data that is coming in. The format is text and binary(images) does anyone know of any code already to parse the nsdata object that is sent. Thank You.

ah, Yeah, it does. You may want to post your code or review the documentation. Perhaps your invoking NSURLConnection incorrectly.

Related

Save NSMutableArray with NSUserDefaults

i'm french so maybe i'll make some mistakes, sorry about that :D
I explain my problem, I have a XMLParser who generates NSString (title, category, url, ...), I would like the stream that is generated is to save the user can read the stream even if it is not connected to the internet.
The flow generated can be found here ==> http://www.recontv.fr/testXml.xml
I try different solutions and each time, I should go about it wrong but its not working. : (
Do you need my code? Did I explain my problem?
Thank you in advance for your help!
PS: I post on differents forum for a answer, if I take it somewhere else, i pick here too.
NSUserDefaults isn't really meant to be used for saving an array from XML to it. Your main solutions are to save the XML to a file and re-parse when the user needs to access the information offline, or you can save the NSArray itself to a file using either its writeToFile: methods, or NSKeyedArchiver/NSKeyedUnarchiver. In each case you must ensure that the objects in your array conform to the NSCoding protocol.

Processing Non-Well-Formed HTML with DOM

I have got a HTML which has obtained from a web site's source code. Im sending data with post method from my page to the web site, and the response is source code. I need some text in the source.
The document is non-well-formed. So, i can not use DOM, and i can not separate tag and data with DOM.
How can i separate tag and data, and how can i get the only data?
I'm using PHP.
Thanks.
I found something about getting data from html source code. I said in question, im using PHP.
I will use preg_match_all function and regular expression. Hopefully, i can overcome ;)
Thx to all who interested ;)

NSRequest vs initWithURL

Should I use initWithURL or NSRequest to download an XML file when using NSXMLParser?
I'm downloading a feed and I'd like to get progress information for my download.
Check out ASIHTTP as that is really good at handling this sort of thing....
http://allseeing-i.com/ASIHTTPRequest/
As pointed out the above is now not supported. I would recommend looking at AFNetworking instead now.
https://github.com/AFNetworking/AFNetworking
Just a sidenote. initWithUrl will download the file synchronously. If you want to parse the XML stream on-the-fly, here's an article (plus code) about that matter:
http://benreeves.co.uk/iphone-expat-xml-parser-wrapper/

How parse html string in iphone

i m using php file for using data in my application,
in this file i post data on the server and if i get the data from the server
then it is in html formate.
so problem is that i have a string with html tags how i use data in that string.
how i extract data from html string.
Use NSXMLParser class. it works for HTML too. There are three useful delegate methods.
If your HTML out put is some simple data - may be you can write some simple NSString parser your self like 'markhunte' mentioned, if you have large complex data in HTML then you have to go for some open source parsers.
Cocoa does not provide HTML parser, Forum discussion claims in some case XML parser itself work for you, but I never go it working for my data.
In my case I had very simple TAG which I had handled using my own parser using NSString.
I have used the code from --> Flatten-html-content-ie-strip-tags-cocoaobjective-c.
There are also examples of its use on SO.
Just use NSScanner, it is great for searching in between tags that are permanent. If you post some page code I help you set up the scanner.

Get Image from Byte Aarray

Hope You all are fine and also in one of your best of moods!!
Hope You all are Enjoying iPhone development.
I herewith one issue that i am not able to solve, may be i don't know the depth concept of iPhone.
So Its my humble requet to you to guide me or suggest or share your ideas.
I do find an issue with getting an image from Bytes array.
I am calling a webservice which returns an image in form of Bytes Array as response.
I have Converted this bytes array in to form of NSData, Now i have NSData, But When i Try to get an image from this NSData, It shows nil.
I Did lots of R&D and Find one suggestion to use base64 encoder, But unfortunately because of not proper guidance I was not able to Implement that.
I was also suggested to use OPenSSL Library for base64 from url http://www.cocoadev.com/index.pl?BaseSixtyFour
But again i was not able to include #include #include these two files. as in Newer Version of SDK 3.X family Apple has depreciated those (as i guess).
So Now i need help from you guys. kindly help me if you have solution or if you know the steps to solve these.
Looking Forwards.
Regards,
Arun Thakkar
Using OpenSSL on the iPhone seems like a very heavy-weight solution if all you need is Base64 encoding/decoding. Look at this post for how to use a category for NSData to add base64 encoding/decoding. You want the second section of this blog post as the first deals with OpenSSL :)
base64-encoding-options-on-mac-and-iphone