These are chat archives for devslopes/swiftios9

9th
Nov 2015
Doug Trance
@dtrance2k6
Nov 09 2015 02:36
Hello everyone, just got this course on Friday and have been learning alot, I've messed with swift before in the past, but I'm glad I picked up this course already! Just started the auto layout goodness!
Mark Price
@spentak
Nov 09 2015 03:19
@dtrance2k6 awesome!
Jay Hamilton
@jaydaro
Nov 09 2015 03:21
devslopes for life!
Mark Price
@spentak
Nov 09 2015 03:21
haha ill make a shirt with that phrase
Jay Hamilton
@jaydaro
Nov 09 2015 03:34
Screen Shot 2015-11-08 at 8.33.46 PM.png
Mark Price
@spentak
Nov 09 2015 03:34
lol
Aizaz Khaja
@aizkhaj
Nov 09 2015 03:41
hey, I was just going through the calculator app part 1 vid, and got to the part where i stacked all rows of buttons…….and then this happened:
Screen Shot 2015-11-08 at 9.32.59 PM.png
it all disappeared :/
(calc has power of invisibility)
__TaYmuR__
@telmetwally
Nov 09 2015 04:07
I'm having trouble with my firebase app the postcell doesn't update it shows blank screen even though I'm sure i did everything right
Leonardo Amigoni
@amigoni
Nov 09 2015 15:12

Hi Guys looking for some help on an error that I am getting on the Showcase App the one in section 9. Here is the error.

2015-11-09 16:10:01.032 showcase[6309:265224] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSCache 0x7a634450> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key https://s-media-cache-ak0.pinimg.com/736x/42/23/97/42239797be9792b4b0dc6a4d4e05cfd5.jpg.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00633a94 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x02439e02 objc_exception_throw + 50
    2   CoreFoundation                      0x006336b1 -[NSException raise] + 17
    3   Foundation                          0x00c8987c -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x00be3e4a _NSSetUsingKeyValueSetter + 115
    5   Foundation                          0x00be3dcf -[NSObject(NSKeyValueCoding) setValue:forKey:] + 295
    6   showcase                            0x000ad28c _TFFC8showcase8PostCell13configureCellFS0_FTCS_4Post5imageGSqCSo7UIImage__T_U_FTGSqCSo12NSURLRequest_GSqCSo17NSHTTPURLResponse_GSqCSo6NSData_GSqCSo7NSError__T_ + 1644
    7   showcase                            0x000abce7 _TPA__TFFC8showcase8PostCell13configureCellFS0_FTCS_4Post5imageGSqCSo7UIImage__T_U_FTGSqCSo12NSURLRequest_GSqCSo17NSHTTPURLResponse_GSqCSo6NSData_GSqCSo7NSError__T_ + 103
    8   Alamofire                           0x00278ff5 _TFFFC9Alamofire7Request8responseFS0_FT5queueGSqPSo17OS_dispatch_queue__17completionHandlerFTGSqCSo12NSURLRequest_GSqCSo17NSHTTPURLResponse_GSqCSo6NSData_GSqCSo7NSError__T__DS0_U_FT_T_U_FT_T_ + 261
    9   Alamofire                           0x00278c47 _TPA__TFFFC9Alamofire7Request8responseFS0_FT5queueGSqPSo17OS_dispatch_queue__17completionHandlerFTGSqCSo12NSURLRequest_GSqCSo17NSHTTPURLResponse_GSqCSo6NSData_GSqCSo7NSError__T__DS0_U_FT_T_U_FT_T_ + 87
    10  Alamofire                           0x0023bf38 _TTRXFo__dT__XFdCb__dT__ + 40
    11  libdispatch.dylib                   0x03b5f3ff _dispatch_call_block_and_release + 15
    12  libdispatch.dylib                   0x03b829cd _dispatch_client_callout + 14
    13  libdispatch.dylib                   0x03b68018 _dispatch_main_queue_callback_4CF + 910
    14  CoreFoundation                      0x0058570e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
    15  CoreFoundation                      0x00543454 __CFRunLoopRun + 2356
    16  CoreFoundation                      0x00542866 CFRunLoopRunSpecific + 470
    17  CoreFoundation                      0x0054267b CFRunLoopRunInMode + 123
    18  GraphicsServices                    0x07259664 GSEventRunModal + 192
    19  GraphicsServices                    0x072594a1 GSEventRun + 104
    20  UIKit                               0x01018cc1 UIApplicationMain + 160
    21  showcase                            0x000a77cc main + 140
    22  libdyld.dylib                       0x03baca21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

Here is the code. I don't understand why it's crashing. the Image seems to be an image in memory and so does the string. Any clues?

func configureCell(post: Post, image: UIImage?){
        self.post = post
        self.descriptionText.text = post.postDescription
        self.likesLabel.text = "\(post.likes)"

        if post.imageUrl != nil {
            if image != nil {
                self.showcaseImage.image = image
                self.showcaseImage.hidden = false
            } else {
                request = Alamofire.request(.GET, post.imageUrl!).validate(contentType: ["image/*"]).response(completionHandler: { request, response, data, err in

                    if err == nil {
                        //Change to if let
                        let image1 = UIImage(data: data!)!
                        self.showcaseImage.image = image1
                        self.showcaseImage.hidden = false
                        FeedVC.imageCache.setValue(image1, forKey: self.post.imageUrl!)
                    }
                })
            }

        } else {
            self.showcaseImage.hidden = true
        }
    }
Leonardo Amigoni
@amigoni
Nov 09 2015 15:17

LOL found the solution again. Should have been

setObject

not

setValue
AxlFlame
@AxlFlame
Nov 09 2015 19:25

Hi, @spentak and chat!

So, heres what Im trying to do:

I`m trying to create a table that shows some flight data. For that I create the table via storyboard and the idea is that each cell of the table represents one trip (i.e all the flights needed to fly from city A to city B). The problem is that one trip can have many flights and I need a table configuration that I can create multiple flight lines inside each trip cell.

Each flight line would display some info: Flight number, route, departure time and duration.

Is it possible to create something like that? Say, a table with n sub-cells within a cell programmatically? Or is there a better solution?

My issue with this is that I need a specific layout for the flight lines (so it fits properly inside the table) and I dont know if theres a way to inflate the layout on the code or create an layout file and instantiate a cell with it, like in Android.

Jack Davis
@jackd942
Nov 09 2015 19:59
Wouldn’t that be where you would set numberOfSectionsInTableView to something greater than 1? i.e. 1 section for each trip and then numberOfRowsInSection would return the number of flights in each trip...
you could use an array of arrays
Mark Price
@spentak
Nov 09 2015 20:04
@AxlFlame I would definitely make sure to use Object Oriented Programming. Have a Trip class and a Flight class. The Trip class would hold an array of Flights
Jack Davis
@jackd942
Nov 09 2015 20:06
Wouldn’t you need an array of trip objects that held arrays of flight objects @spentak ?
Mark Price
@spentak
Nov 09 2015 20:09

so if i understand the problem correctly Axl wants a tableview that has one cell for each trip. but in that cell it shows multiple times/flights. So If I really wanted to show all the flights in a single cell, I would have one cell for each trip, but then programmatically I would add a UILabel for each flight in side that cell, then expand the cell height accordingly. Or a better way is only show the trip in each cell, then when you tap on it another view pops up with all the flights.

So your View Controller would hold an array of Trips - and the Trip class has a property var flights: [Flight]!

So yes you would have an array of trip objects, each trip object holding an array of flight objects
Jack Davis
@jackd942
Nov 09 2015 20:10
ok
Good explanation…so numberOfSectionsInTableView and numberOfRowsInSection really wouldn’t come into play in that instance
slupton89
@slupton89
Nov 09 2015 20:15
@spentak I'm trying to sign up for the free art pack that you emailed about but I'm having a problem. When I click the signup page on facebook there is nothing to fill in, the page is blank.
Mark Price
@spentak
Nov 09 2015 20:19
maybe try a different browser
this is happening for a couple of people
The most important thing is leaving an honest review if you can't get the form to work
then just message me on Udemy
MrGobert
@MrGobert
Nov 09 2015 20:35

Hello everyone. Just finished Section 4 and I'm feeling great (mostly). I always get a bit of anxiety before entering a new Section. A lack of confidence that I'll be able to grasp the next challenge. Though after every Section completed that feeling gets smaller and smaller.

Said all that to say...if you're feeling discouraged, keep going! Go over lessons multiple times and experiment. I learned a lot by screwing things up making a custom Calculator app. :smile:

Jack Davis
@jackd942
Nov 09 2015 20:40
Agreed @MrGobert …I used to have a boss and mentor that always said “Repetition is the price of knowledge”.
Mark Price
@spentak
Nov 09 2015 20:44
Good tip @MrGobert
neelusb
@neelusb
Nov 09 2015 21:33
I have the course on StackSkills, and haven't received anything about the art pack
Mark Price
@spentak
Nov 09 2015 21:34
@neelusb hmm, this is kind of a Udemy only promotion.
im encouraging my students to take time to leave an honest review
neelusb
@neelusb
Nov 09 2015 21:35
Oh ok, thanks for clarifying :)