Xcode RSS Images - ios

I have an app that I am developing in Xcode which retrieves a RSS feed from my site and puts it into a table. Recently, I have created a new homepage with a featured article at the top, and I want to be able to have the image from the articles shown with it. Is there any way I can do this?

I am going to assume that in the RSS Feed there is a key called image or similar which its value will be an address pointing to the image.
After you load the article you should download each image asynchronously. For this I'd suggest you use NSOperation and NSOperationQueue.
There is a tutorial in Ray Wenderlich website which shows how to accomplish this.
You could use some kind of cache to avoid the images downloading each time.

Related

Offline Blog Reading (Images) capability (cache)?

I am creating a UITableView where I will load and show data from my blog's feed. This data will be updated daily, on launch or dynamically.
What I want to do is provide some offline capability to this screen, as such if user isnt connected to internet, he can still see the view and its contents (mainly post list with its images).
For such I will need some hints or solutions on how to do this, probably cache ?
Basically if user is connected to net, the view will update the contents and fetch he blog post feeds from my API and update it with new content, but if user isnt connected to net, he should see the last fetched/updated content (with images) till he connects to net and updates the view.
For this probably I need to save/cache 3 things which I will need and use in the View, all of which are fetched and provided by my API:- The Post Title, Date and its cover image.
Would best way would be to add them to some dictionary, use NSCache (aint it temporary ?) or download images locally and then save them as UIImage along with NSString (title/date) in a dic/array ?
I would like to know as many different approaches possible.
After testing a bit, I found caching images can solve my offline image problem, but is cache temporary or how long can it last ? How can I store that cached image with my text data in some dictionary to load it if network isnt connected ?
You can use a ready to use, opensource caching library like SDWebImage. It provides asynchronous image downloading as well as caching, so any image that is cached will appear in place when your app is offline.

iOS Image search on the web

I am developing the functionality of letting the user search the internet for images through any query.
There are services/APIs like Google's (I read that it is deprecated), Yahoo and Bing etc. I want to know, is there any FREE services/APIs/frameworks/libraries for iOS to search for images against any query?
We can fetch the thumbnails against the results URL and populate a grid-view to show the thumbnails. Then download the actual image in the App once the user clicks on a particular image. Is there any such service that is free?
Thanks
you can use flickr, in the Ray Wenderlich site you have a good tutorial of how to use it. About the services you mentions I don't know if the has a public (free) API

Create an XML file to save app data

I am creating an app where there is a page which enables users to create a small project, I mean painting with the brush, adding labels, text fields, and adding UIImageViews and placing an image in them using the iOS library. then a screenshot is taken (for now) and it is uploaded on dropbox. from a tableview the users will be able to see all the uploaded documents. but the point is that it is only a screenshot. I wanted to upload things in a way that the textfields could be scrolled, and when I add the video feature, see the video. then add comments. I thought of uploading all the images, photos, textviews separately, and then save all the position of the pieces in an XML, so that the projects can be viewed from the table view: when a row is selected the app opens the XML and in base of that composes all the pieces like a puzzle. I decided to use Google library, (data), but I can't seem to find where to download the sample project with the library. so I put it at a side. I then tried to use NSXML parser, but I only see tutorials that enable asccess to an xml file, not actually create one according to each project!! Help!! How can I proceed? Any suggestions or tutorials? May be were to give me the link to data project, and please not to the google developer page or trunk, because it is a mess!!
thanks for the help in advance
There is a very good tutorial by Ray Wenderlich's web site (a great iOS dev and tutorial resource) on how to create XML with GDataXML here:
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml
Here is the GitHub repo: https://github.com/neonichu/GDataXML
OR you could use the very simple, very easy to use standard NSPropertyListSerialization:dataWithPropertyList:format:options:error and this is how you would do it:
Populate it with NSArray's and NSDictionary's (this is the part that requires the most code - but it isn't difficult to do). The objects in your dictionary are the children and sub children (which may be NSArray's of NSDictionaries). Then use the following to write it out:
NSData *xmlData = [NSPropertyListSerialization dataWithPropertyList: resultLists
format: NSPropertyListXMLFormat_v1_0
options: 0
error: &error];
//----- DO ERROR CHECKING (left out to simplify)
BOOL result = [xmlData writeToFile:arrayFileName atomically:YES];
Boom. An XML file.
I'm backing up a core data file and it is relatively trivial to do.
I normally like Ray Wenderlich's web site, but in this case he makes something that is very easy to do very complex. I've done it that way and honestly, the Apple way is much, much easier.

Upload image and text data in iphone

Hi stackoverflow friends
I want to upload text along with image to the webserver. I saw so many examples for uploading images to webserver but nobody explains how to send text from a uitextField along with image.
All of them points this link
http://iphone.zcentric.com/2008/08/29/post-a-uiimage-to-the-web/
This link gives only how to upload images only. I want to send some text values along with this. Could you please send me some example code.
Any help is Appreciable
I recommend you try ASIHTTPRequest. It allows you to easily accomplish such a task. You can create a PHP file that will receive your data via POST - ASIHTTPRequest provides some easy to use methods for this.
See here.
you can Use Evernote API for this purpose

How to recreate an image preview from outside websites?

Similar to Facebook's UI, I am attempting at generating a preview image from an external linked website. So that when a user types in a url he is linking, the UI will by default, scan that site for an img and scrape a preview thumb.
Is there a specific name for this technique? Or can anyone point me in the direction of learning this?
Thanks so much!
Its called scraping. There is a library called scrAPI.
Here is a code example http://crunchlife.com/articles/2007/08/13/code-snippet-ruby-image-scraper
There are a couple different options when it comes to page scraping. Another one to check out would be nokogiri, http://nokogiri.org/. You can find tutorials on how to use it at http://nokogiri.org/tutorials.
Instead of grabbing an image from the site, why not grab the image of the entire page? You could make use of a free screenshot service like http://www.websnapr.com/ or http://www.thumbshots.com/ among others. In one application, I use that for my preview image, and use nokogiri to scrape the page title and description. Just an idea.

Resources