Please note, this blog entry is from a previous course. You might want to check out the current one.
Lecture #11 starts with an introduction to table views, their styles and elements, how to fill theirs cells using data sources, how to react to user interactions using delegates, table segues and table spinners for refreshing.
The second theoretical part addresses universal applications adding storyboards and functionality for the iPad, as well as iPad specific controllers like the split-view controller and popovers.
The practical part of the lecture demonstrates how to use table views and split view controllers.
The code for this lecture is available at gitub as well as from Stanford
The lecture as well as its slides are available via iTunes called “11. Table View and iPad”.
Hi! I am trying to run the code that you posted on gitHub and it keeps giving me this error:
2014-07-31 19:32:16.613 Shutterbug[1330:1303] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘data parameter is nil’
*** First throw call stack:
(
0 CoreFoundation 0x017f41e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015738e5 objc_exception_throw + 44
2 CoreFoundation 0x017f3fbb +[NSException raise:format:] + 139
3 Foundation 0x012b9bd2 +[NSJSONSerialization JSONObjectWithData:options:error:] + 67
4 Shutterbug 0x00001ef4 __40-[JustPostedFlickrPhotosTVC fetchPhotos]_block_invoke + 132
5 libdispatch.dylib 0x01bf17b8 _dispatch_call_block_and_release + 15
6 libdispatch.dylib 0x01c064d0 _dispatch_client_callout + 14
7 libdispatch.dylib 0x01bf4047 _dispatch_queue_drain + 452
8 libdispatch.dylib 0x01bf3e42 _dispatch_queue_invoke + 128
9 libdispatch.dylib 0x01bf4de2 _dispatch_root_queue_drain + 78
10 libdispatch.dylib 0x01bf5127 _dispatch_worker_thread2 + 39
11 libsystem_pthread.dylib 0x01f35dab _pthread_wqthread + 336
12 libsystem_pthread.dylib 0x01f39cce start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I requested and got my own API key from Flickr, which I then copied into the #define of the API key
Could you confirm/tell me if your code currently runs/ran into the same problems?
Thank you in Advance!
Try to set breakpoints to see where exactly the problem happens, and why. Nevertheless, Flickr changed it’s API recently. Last time I use code from the course, I had to replace the “http://” URLS from the code provided by Stanford with “https:” links … a week later it worked again with the old links … However, it might be they changed even more …
It turns out to be something mismatching of the URLForQuery, which is why it says the data parameter is nil, since the link does not provide anything.
So if you go to FlickrFetcher.m, under the method URLforRecentGeoreferencedPhotos,
replace the link with @”https://api.flickr.com/services/rest/?method=flickr.photos.search&license=1,2,4,7&has_geo=1&extras=original_format,description,geo,date_upload,owner_name”
and then it should work.
I doubled check the link and it still does not work for me. Apparently, Flickr has changed the API in some way.
The URL – https://https://api.flickr.com/services/rest/?method=flickr.photos.search&license=1,2,4,7&has_geo=1&extras=original_format,description,geo,date_upload,owner_name
Just returns:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
I have been reading the Flickr API website and it sounds like you need a key from them. I am guessing the one that the class used original has expired or the format has change since then.
This sucks because without that data, I cannot really continue to work on the Shutterbug app for the homework.
You have to apply for your key at http://www.flickr.com/services/api/misc.api_keys.html
and set this key in FlickrAPIKey.h … if you want to test the key in your browser you need to add the key to your link …
The key alone seems not to be sufficient since Flickr use the authentification method “OAuth1.0A”…
Finally, I tested it myself:
Is it possible that your simulator or your phone (I don’t know on what you run it) has stored a permission before Flickr has adopted only the OAuth1.0a method?
Because on my simulator I received the same error : “NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)” …
Or can I have a problem with my simulator?
Because I also tested to run the Shutterbug Version given here : , by replacing the Flickr directory with the correct version directory (with the “https” inside), and put in it my own key…. but I got the same error.
Moreover when I test in my web browser the URL “https://api.flickr.com/services/rest/?method=flickr.photos.search&license=1,2,4,7&has_geo=1&extras=original_format,description,geo,date_upload,owner_name&format=json&nojsoncallback=1&api_key=”
with my own key at the end, it works so well ! I get well a pur Json array!
I confess I’m a little bit lost right now…
Any idea where I can miss something?
Somebody else got the same issue?
… I removed the app before running it from the simulator, thus I don’t think there was something stored which gave me special permissions. Also I don’t think that Flickr requires OAuth authentication for the API, because the API is meant to write applications which lots of people should be able to use with their own authentication to access their individual accounts. Also, we do not access specific accounts, but only publicly available data …
Right! I agree with you we only access to public data! That’s why I looked for in others directions what could be the cause of my problem…
And finally I found it!
That was “Avast”antivirus software which blocked this connection in some way!
I deleted it this morning to test the app on iOS Simulator without it, and it worked very well !!
Thank you again Martin, to have taken the time to answer me and tested it on your own simulator!
I hope this answer can help people who encounter this similar problem!