Grabbing data from websites - ios

I am just wondering how you would go about grabbing articles from BBC and automatically updating this information in an iOS app. So basically what I want to do is add new articles to my application automatically whenever BBC release them. Is this possible?

Its very simple.. Grab the sample code from this tutorial. http://www.appcoda.com/ios-programming-rss-reader-tutorial/
and in APPMasterViewController.m change url to something like
NSURL *url = [NSURL URLWithString:#"http://feeds.bbci.co.uk/news/rss.xml”];
you can get other types of news feeds from their page http://www.bbc.co.uk/news/10628494..

Yes you can do this by getting the information from their RSS Feed.
http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml
it will return you an XML document and you can parse it and dispaly them in your app
sample article info
<title>US boy charged in death of teacher</title>
<description>A 14-year-old boy has been charged in the death of a teacher whose body was found in woodland behind her school.</description>
<link>http://www.bbc.co.uk/news/world-us-canada-24644203#sa-ns_mchannel=rss&ns_source=PublicRSS20-sa</link>
<guid isPermaLink="false">http://www.bbc.co.uk/news/world-us-canada-24644203</guid>
<pubDate>Wed, 23 Oct 2013 19:03:05 GMT</pubDate>
<media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/70673000/jpg/_70673073_chism.jpg"/>
<media:thumbnail width="144" height="81" url="http://news.bbcimg.co.uk/media/images/70673000/jpg/_70673074_chism.jpg"/>
</item>

Check out APIs for developers from this link:
http://www.bbc.co.uk/developer/technology/apis.html
Grab your api and parse date - in my opinion JSON is the most comfortable format on iOS.
Then you could compare fresh, parsed data to data on the device and check is there something new.

Related

iOS failing to render vcf file

I use twilio to share contact information of my users. I've been doing this for 6 months with no problems.
Recently, I started receiving bug reports that the contact card isn't coming through. iOS is receiving it as an unknown attachment with a file name such as 'text_0.x-vcard' [see screenshot]
I'm unable to reproduce this on my device - I've received reports of this from users with an iPhone 7, iPhone 6, and iPhone 5 - nothing consistent. No consistency in OS either. The vcf file is valid, and it works for 90% of users.
Any ideas? Here is an example of a vcf file - works on my phone, doesn't work on one of the other devices.
BEGIN:VCARD
VERSION:3.0
N:Doe;John;;;
FN:John Doe
ORG:Example.com Inc.;
TITLE:Imaginary test person
EMAIL;type=INTERNET;type=WORK;type=pref:johnDoe#example.org
TEL;type=WORK;type=pref:+1 617 555 1212
TEL;type=WORK:+1 (617) 555-1234
TEL;type=CELL:+1 781 555 1212
TEL;type=HOME:+1 202 555 1212
item1.ADR;type=WORK:;;2 Enterprise Avenue;Worktown;NY;01111;USA
item1.X-ABADR:us
item2.ADR;type=HOME;type=pref:;;3 Acacia Avenue;Hoemtown;MA;02222;USA
item2.X-ABADR:us
NOTE:John Doe has a long and varied history\, being documented on more police files that anyone else. Reports of his death are alas numerous.
item3.URL;type=pref:http\://www.example/com/doe
item3.X-ABLabel:_$!<HomePage>!$_
item4.URL:http\://www.example.com/Joe/foaf.df
item4.X-ABLabel:FOAF
item5.X-ABRELATEDNAMES;type=pref:Jane Doe
item5.X-ABLabel:_$!<Friend>!$_
CATEGORIES:Work,Test group
X-ABUID:5AD380FD-B2DE-4261-BA99-DE1D1DB52FBE\:ABPerson
END:VCARD
Steph,
I'm new to Stack Exchange, so I don't know how else to send this. You show one of your Twilio numbers above.
I am seeing similar issues, and I believe it is all related to your content type. Try a
curl --head <your vcard web address>
The only time I've had it work for me is when the it returned
Content-Type: text/x-vcard; charset=utf-8; name="fileName.vcf"
I don't know how long this link will last but try sending this vcard VCF File (Send from http address), it works for me on Twilio w/ iOS 10.3.3
I think your right about it being related to security; why would you want a 'text/html' file being being executed like a 'text/x-vcard' file. I don't think internal header modifiers will work, let me know.

How to get data(string,url,image,etc) from UIPasteboard while App is in Background State

i was digging on "How to get data from UIPasteboard while App is in background state" but could not find something useful.i followed this Link
and this but not helpful. any suggestions will be appreciated.
Daan Raman had a tutorial here. It have everything you want.
There are total 4 type of UIPasteboardNotifications
UIPasteboardChangedNotification;
UIPasteboardChangedTypesAddedKey;
UIPasteboardChangedTypesRemovedKey;
UIPasteboardRemovedNotification;
UIPasteboardChangedNotification generate notification when the pasteboard item changed. UIPasteboardChangedTypesRemovedKey and UIPasteboardRemovedNotification are the changes which are mode in pasteboard dictionary. UIPasteboardRemovedNotification when an app remove the pasteboard object.

How To Display Youtube Video Thumbnail?

I have a fragment with a ScrollView and I want to display the YouTube thumbnail of a video as one of the items in the scrollview.
I looked up everywhere but couldn't understand how to, I really need the base.
Please help me, I'm stuck like this for days...
This method supposed to take the VIDEO_ID(from YouTube) and take it's thumbnail.
This thumnbail should be displayed in youTubeThumbnailView.
Here is something I tried:
public void getThumbnail(){
String VIDEO_ID = "xxxxxx";
YouTubeThumbnailView youTubeThumbnailView = new YouTubeThumbnailView(getActivity());
youTubeThumbnailView = (YouTubeThumbnailView)youTubeThumbnailView.findViewById(R.id.thumbnail);
youTubeThumbnailView.//Dont know how to continue :(.
}
Take a look at the updated version of the youtube-android sdk (version 1.2.1 released on 22 Jan 2015).
The changelog states something interesting about thumnails:
The YouTubeThumbnailLoader interface's documentation has been updated to note that you must call the interface's release() method when you are finished with the YouTubeThumbnailLoader. The documentation for the YouTubeThumbnailView class also mentions this requirement.

Gracenote API - No track link data

Currently, in my AppDelegate, I have an instance variable declared for GNConfig that is set up with all properties I would like to receive.
This instance of GNconfig is used by any class that makes a gracenote request.
The requests I am using are recognition from an audio stream, recognition by local file and a text search which populates an array. The array is then used for track lookups by id for the corresponding array item.
I am able to get all the content I need, except for track and album link data (always returns null).
I have tried plenty of different suggestions and guides with no luck.
Could somebody please help me out? This data is essential to my app and my app is pretty much complete except for this big obstacle.
Thanks in advance.
** edit **
This is in my appDelegate:
_gnConfig = [GNConfig init:#"XXXXXXX-XXXXXXXXXXXXXXXXXXXXXXX"];
[_gnConfig setProperty:#"content.coverArt" value:#"1"];
[_gnConfig setProperty:#"content.coverArt.sizePreference" value:#"LARGE"];
[_gnConfig setProperty:#"content.allowFullResponse" value:#"1"];
I have this in one of my class methods:
NSURL *filePath = [item valueForProperty:MPMediaItemPropertyAssetURL];
[GNOperations recognizeMIDFileFromFile:self config:[[AppDelegate sharedDelegate] gnConfig] fileUrl:filePath];
In the delegate method I have:
gracenoteResponseItem = [result bestResponse];
NSLog("%#", [gracenoteResponseItem trackLinkData]);
Some tracks may not have link data available.
Also if you are doing a local lookup then you will have to set this config option:
[publicProperties setObject:#“1"forKey:#"content.allowfullresponse"];
Unless you have explicitly had your client ID entitled for Link IDs (aka 'external' or '3rd party' IDs), you won't get any in your responses.
By default, Gracenote Open Developer client IDs aren't entitled for any external IDs. You need to coordinate with Gracenote to entitle your client ID to start receiving the desired IDs.

YouTube API not returning full description

I'm currently using the YouTube API V2 inside my iOS app, however the description seems to be bugged and cuts off. It never returns the full description. It always stops at .... I've never had this issue before, does anyone know what I'm doing wrong or what YouTube did to their API ?
Here's the API request I'm calling : http://gdata.youtube.com/feeds/api/users/DaveDays/uploads?q=&v=2&start-index=1&max-results=50&orderby=published&time=this_week
Example: Instead of returning this description
This is Dave's reaction/parody to Miley Cyrus video We Can't Stop.
iTunes: https://itunes.apple.com/us/album/we-...
Twitter: http://www.twitter.com/davedays
Facebook: http://www.facebook.com/ddays
Instagram: http://www.instagram.com/davedays
Merch!! http://www.westaspenmerch.com/davedays
Credits:
Chris http://www.youtube.com/iamchrisc
Nikki http://www.youtube.com/nikkinhollywood
Joey: http://www.youtube.com/bambamjoey
Matt: http://www.youtube.com/matthewdamc
Parody of Miley Cyrus' song We Can't Stop! Twerking it upp! Hi Miley Cyrus. We can't stop either. Miley Cyrus.
it returns this one
This is Dave's reaction/parody to Miley Cyrus video We Can't Stop. iTunes: https://itunes.apple.com/us/album/we-cant-stop-parody-single/id685057235 Twitter: ...
If you think its a bug, then check and report it at: https://code.google.com/p/gdata-issues/issues/list?q=label:API-YouTube
If additional parameters changes the request into a search request, then it will give a short description.
The url and basic parameters do return the full description. Like in: http://gdata.youtube.com/feeds/api/users/DaveDays/uploads?v=2&start-index=1&max-results=50
The add of the other parameters seems to be the cause.
But, "time=this_week" seems to give the longer description:
http://gdata.youtube.com/feeds/api/users/DaveDays/uploads?v=2&start-index=1&max-results=50&time=this_week
Since its about the uploads of one channel, an option could be to get all videos first and do ordering and/or filtering yourself, later.

Resources