These are chat archives for devslopes/swiftios9

23rd
Oct 2015
jkw224
@jkw224
Oct 23 2015 01:52
Hey Mark,
Or anyone else who might be interested in finding a tricky error. I'm working on the last app (social network app), I still haven't been able to solve my error. It's a sematic error and I've debugged a few times but still can't figure out why images I select won't upload into the app.
If anyone could take a look and lend me a hand, I'd appreciate it. You can download from Github at:
The app loads up fine, I can select an image from my iPhone and press post, I'm pretty sure the image saves up to firebase just fine, but my logic must be wrong because the image doesn't show up in my app
Sketchy Swift
@HardcoreIOS
Oct 23 2015 01:59
@spentak I downloaded the pokemon app, but i am getting an error saying that there is no such module, Alamofire
Screen Shot 2015-10-22 at 9.59.43 PM.png
Any ideas
GuappaApps
@GuappaApps
Oct 23 2015 02:14
Hey Mark, I've had to resort to using XIB files for some view controllers in an app. What's the best way to link tableview cells in that XIB file to other view controllers? It baffles me why Apple don't offer the same functionality for those view controllers as in the storyboard. Really useful and easy to link cells and buttons in that view. Much more difficult in XIBs :(
Mark Price
@spentak
Oct 23 2015 02:19
@jkw224 will look
@GuappaApps will look at yours too
Sketchy Swift
@HardcoreIOS
Oct 23 2015 02:20
Something is wrong with importing Alamofire @spentak
This was ur downloaded project
Mark Price
@spentak
Oct 23 2015 02:25
Do pod install from terminal
Sketchy Swift
@HardcoreIOS
Oct 23 2015 02:26
How can I do that?
Mark Price
@spentak
Oct 23 2015 02:52
@HardcoreIOS watch the tutorials on the pokedex from the beginning
@GuappaApps I don't understand why you have to use a xib
Mark Price
@spentak
Oct 23 2015 03:02
@jkw224 Jon I found your bug ;)
it is line 62
GuappaApps
@GuappaApps
Oct 23 2015 03:04
@spentak - because I am using a scrollview to navigate between views. But also because by having all of my views on one storyboard, it makes loading times horrifically long so I figured I would break out the project. I can't find anywhere tips on how to code tableview menus. I guess I've made it difficult for myself, but if I compromise, I don't get the swipe navigation I'm looking for.
Mark Price
@spentak
Oct 23 2015 03:04
@jkw224 in FeedCell.swift
@GuappaApps you can have multiple storyboards
GuappaApps
@GuappaApps
Oct 23 2015 03:05
Thanks.
Why do XIB VCs suck so bad for adding UI elements? You don't get half of what you get with storyboards :(
Mark Price
@spentak
Oct 23 2015 03:07
What do you mean
GuappaApps
@GuappaApps
Oct 23 2015 03:08
Like for example you add a tableview into a xib, but you never get to add a tableviewcell into that. For example you add a button, but you can't link that button to anything besides using customclasses (from what I can tell) and then assigning those classes to perform specific actions. It seems like by using XIBs you really do hamper what you can achieve (partly probably why you asked why I've gone down that route I assume).
Mark Price
@spentak
Oct 23 2015 03:08
ah
yes
GuappaApps
@GuappaApps
Oct 23 2015 03:09
It baffles me why, just seems inconsistent from Apple to not offer up that functionality into separate views - when its there for storyboards
Mark Price
@spentak
Oct 23 2015 03:09
well XIBs were before storyboards
GuappaApps
@GuappaApps
Oct 23 2015 03:09
sure
Mark Price
@spentak
Oct 23 2015 03:09
and they want people to use storyboards as their first choice
GuappaApps
@GuappaApps
Oct 23 2015 03:14
Meh :( might have to rethink my approach then.
Great article by the way, thanks for sharing
Presume you avoid XIBs where you can then, besides modals etc?
Mark Price
@spentak
Oct 23 2015 03:20
depends. for instance if you are building a framework that you want to distribute to other developers you wont use storyboards, you'll use xibs
JPROFFICIAL
@JPROFFICIAL
Oct 23 2015 03:33
Hey @spentak, in lecture 70 you use URL's to grab images, but I want to use images already in my assets folder. I have been stumped by this for the past hour. Wont let me convert Strings (the image names) into UIImages. Any help? I got one picture to work using the UIimage(name: "") syntax, but not all 5 different images. Thanks!
Mark Price
@spentak
Oct 23 2015 03:38
Show me your code
JPROFFICIAL
@JPROFFICIAL
Oct 23 2015 03:39
How do i post a screenshot again?
Screen Shot 2015-10-22 at 10.38.35 PM.png
The mnImg was pointless because I could not figure out how to use my array of images.
Mark Price
@spentak
Oct 23 2015 03:40
What's not working
You don't need the extension
JPROFFICIAL
@JPROFFICIAL
Oct 23 2015 03:41
Im just trying to use my 5 different photos stored in my assets folder, rather than using the one image defined in the img variable.
Mark Price
@spentak
Oct 23 2015 03:43
imageNamed will work
JPROFFICIAL
@JPROFFICIAL
Oct 23 2015 03:44
How so? I guess I am not understanding how. I tried putting all of the minnesota1 strings into it and it threw me an error saying it can only take one string.
Mark Price
@spentak
Oct 23 2015 03:46
Oh
Name your images "Minnesota1" "Minnesota2" etc
JPROFFICIAL
@JPROFFICIAL
Oct 23 2015 03:48
got it :smile: used string interpolation and passed in my mnImg constant.
Mark Price
@spentak
Oct 23 2015 03:48
Ok good
JPROFFICIAL
@JPROFFICIAL
Oct 23 2015 03:48
Thanks for the quick response mark I appreciate it. Course is fantastic! Can't wait to write a good review.
Aizaz Khaja
@aizkhaj
Oct 23 2015 04:04

I've a small question: in the swift conditionals video, when you use the example

if accountTotal >= newCallofDoodyGame {
    print("I just purchased the game!")
} else {
    print("I'm too broke")
}

your result shows as "I just purchased the game!". My result shows "I just purchased the game!\n" <-- what's the \n for?

Mark Price
@spentak
Oct 23 2015 04:05
Newline. It is with a newer version. Playgrounds only. Don't worry about it
Aizaz Khaja
@aizkhaj
Oct 23 2015 04:05
ah ok. thanks!
tbonesteak
@tbonesteak
Oct 23 2015 05:11

I'm working on the Recipez app. I have a question about one of the methods in the NSManagedObject class:

    func getRecipeImg() -> UIImage {
        let img = UIImage(data: self.image!)
        return img
    }

I know we're grabbing an image, but I'm not exactly sure whats going on here- are we just creating a new instance of UIImage and initializing it with data of type self.image?

rmoeller67
@rmoeller67
Oct 23 2015 05:34
Hey Mark, just getting started in the class. Had to get my Mac fixed so I could do Xcode. Anyway I downloaded the Xcode Version 7.1 beta 3 (7B85) and building the SuperCool app is not working for me? I've went through the video twice and built app twice and still not working? Should I not use the latest Beta? Thanks.
The error I get in the output is as follows:
2015-10-22 22:16:56.363 SC2[12690:460357] Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<SC2.ViewController 0x7ff4a3f90cf0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key makemenotsouncool.' First throw call stack:
(
0 CoreFoundation 0x0000000107a23f45 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010974adeb objc_exception_throw + 48
2 CoreFoundation 0x0000000107a23b89 -[NSException raise] + 9
3 Foundation 0x0000000107deda6b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x00000001083cd15c -[UIViewController setValue:forKey:] + 88
5 UIKit 0x00000001085fab81 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000107964a80 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x00000001085f9564 -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x00000001083d3d26 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
9 UIKit 0x00000001083d4652 -[UIViewController loadView] + 178
10 UIKit 0x00000001083d49b0 -[UIViewController loadViewIfRequired] + 138
11 UIKit 0x00000001083d5123 -[UIViewController view] + 27
12 UIKit 0x00000001082ae62c -[UIWindow addRootViewControllerViewIfPossible] + 61
13 UIKit 0x00000001082aed15 -[UIWindow _setHidden:forced:] + 282
14 UIKit 0x00000001082c05b5 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x000000010823a4a6 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
16 UIKit 0x0000000108240ad3 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1750
17 UIKit 0x000000010823dcb3 -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x000000010b60b784 -[FBSSerialQueue _performNext] + 192
19 FrontBoardServices 0x000000010b60baf2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
20 CoreFoundation 0x0000000107950011
CFRUNLOOPISCALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
21 CoreFoundation 0x0000000107945f3c CFRunLoopDoSources0 + 556
22 CoreFoundation 0x00000001079453f3
CFRunLoopRun + 867
23 CoreFoundation 0x0000000107944e08 CFRunLoopRunSpecific + 488
24 UIKit 0x000000010823d605 -[UIApplication _run] + 402
25 UIKit 0x000000010824241d UIApplicationMain + 171
26 SC2 0x000000010784345d main + 109
27 libdyld.dylib 0x000000010a25992d start + 1
28 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Mark Price
@spentak
Oct 23 2015 05:38
It means that your view in your story board is not connected to your code
Welcome!
rmoeller67
@rmoeller67
Oct 23 2015 05:40
thanks
jkw224
@jkw224
Oct 23 2015 07:02
blob

@spentak just got back from a date. Watched Ali play football. Thank you for taking a look at my code!

I changed line 62 (as seen in the screenshot) to if img == nil (instead of: if img != nil) but it still doesn't work

jkw224
@jkw224
Oct 23 2015 07:10
blob
blob
jkw224
@jkw224
Oct 23 2015 07:16
I probably haven't thought outside the box yet, I'm not sure how to change line 62 in FeedCell to make the pictures load into my app. Have a graveyard of failed posts...
blob
blob
Mark Price
@spentak
Oct 23 2015 07:20
Change img to data
jkw224
@jkw224
Oct 23 2015 07:20
blob
Mark Price
@spentak
Oct 23 2015 07:21
If data != nil
jkw224
@jkw224
Oct 23 2015 07:21
Trying it... (the ironic things is I tried doing that)...
blob
blob
Mark Price
@spentak
Oct 23 2015 07:25
Scroll around
I ran your code and made the change and a picture of a phone appears
jkw224
@jkw224
Oct 23 2015 07:26
I don't get it. I scrolled around and this appeared ...
blob
blob
And now when I try to scroll I get a spinny wheel
(a.k.a xcode's freezing and now I can't even scroll through my app)
jkw224
@jkw224
Oct 23 2015 07:34
blob
ah dang, I was hoping you could see the spinning wheel in this last picture (didn't show up via screenshot)
the picture of this phone is a url I had pre-loaded in Firebase
(which is probably throwing you off)
if the code worked you should see a stock photo from the mock iphone
blob
blob
Not the skateboard
jkw224
@jkw224
Oct 23 2015 07:40
The skateboard picture comes from the third-down Firebase object...
blob
blob
I don't think line 62 of FeedCell is the problem :/
Hamza Shaikh
@revive14
Oct 23 2015 08:36
Hello everybody
Mark Price
@spentak
Oct 23 2015 14:59
Hi @revive14
Mike Tchoupiak
@miketch
Oct 23 2015 17:41
@spentak Will support be here now?
Mark Price
@spentak
Oct 23 2015 17:45
Yes
itsalexbrown
@itsalexbrown
Oct 23 2015 22:25
@spentak have you experienced a black background like this? I have not set any background colours. When my detailVC loads, it looks transparent then turns black. No errors
Screen Shot 2015-10-24 at 11.22.51 am.png
Mark Price
@spentak
Oct 23 2015 22:26
this just happened magically?
itsalexbrown
@itsalexbrown
Oct 23 2015 22:26
Yeah :/ tried restarting, clearing Simulator data etc. so strange
Mark Price
@spentak
Oct 23 2015 22:27
you should go into your storyboard, and click the main view of this view controller
make sure the background color is set to white
make sure alpha is 1.0
itsalexbrown
@itsalexbrown
Oct 23 2015 22:28
Ah thanks! Was set to Default. But White fixed it. Can’t remember changing anything ahha but all good now :D
Mark Price
@spentak
Oct 23 2015 22:30
oh good