Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Winter 2015 / Lecture 10 - Broken Twitter Package

Tags:

cs193p

Trying to follow along and code the Smashtag project while watching the Lecture 10 iTunes video.

When I add the dowloaded Twitter package to my Smashtag project, XCode couldn't find the Tweet class when I made reference to it in the TweetTableViewController.

Because of the problem described above, I added the four classes belonging to the Twitter package individually to the project. XCode found the four classes but adding them in this manner generated 11 compile errors.

I'm using XCode Version 6.3 (6D570) which is subsequent to the iOS 8.3 release.

Has anyone else encountered this issue?

Thank you for reading my question. ~ Lee

like image 763
Lee Trent Avatar asked Apr 18 '15 14:04

Lee Trent


1 Answers

Possibly not the most-correct (read: best practice) way to do this, but I'm going to chalk it up to doing what it takes to finish the course.

I just went through the list of compile errors and changed the relevant properties to var instead of let. Constants can't be changed and in the new version of Swift they can only be instantiated once. So for the sake of not rewriting too much code, I chose to make certain properties vars instead of lets.

Other bugs I found following the iTunes U course:

  • The named ‘handler:’ argument needs the name explicitly in a few places.
  • The simulator will show "TwitterRequest: Couldn\'t discover Twitter account type.” until you go to Settings (inside the simulator) and set the Twitter account. At this point I had to reboot the device, as the call is made in the ViewDidLoad, and thus is only called the first time the view loads. (Alternatively, you could close out the app from the app switcher in the simulator and relaunch that way.)

Here is a gist with corrected code that you can use as a Twitter package that will work with the course and has fixes for the aforementioned bugs, minus the Twitter account setting:

https://gist.github.com/mattpetters/ccf87678ccce0c354398

like image 119
mpetts Avatar answered Sep 24 '22 01:09

mpetts