These are chat archives for devslopes/swiftios9

4th
Nov 2015
JPROFFICIAL
@JPROFFICIAL
Nov 04 2015 01:44
Screen Shot 2015-11-03 at 7.43.59 PM.png
For some reason my audio player is giving me nil , although I have implimented the AVFoundation kit and all of the (what I think) necessary delegates. Any help @spentak ?
JPROFFICIAL
@JPROFFICIAL
Nov 04 2015 02:09
Update: Still working on it. Have not found a solution yet. Tried moving "music.mp3" into my main app stack rather than the resources folder and it still throws the same error saying its nil.
JPROFFICIAL
@JPROFFICIAL
Nov 04 2015 03:03

Update: After practically pulling my hair out for an hour and a half, I mixed up some syntax and wallah, it worked. I used musicPlayer = try AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: path))

instead of; NSURL(string: path)!)

Why this worked I have literally no idea. Was it an XCode bug? really stumped me. Que this meme:

Codingmeme.jpg
Aizaz Khaja
@aizkhaj
Nov 04 2015 03:13
@JPROFFICIAL i am not at your level yet, but I can feel your pain and the triumphant feeling that comes from figuring it out :smile:
JPROFFICIAL
@JPROFFICIAL
Nov 04 2015 03:18
@metalhe4der Thank you for relating. I feel that XCode is so bug prone, Some things are just not appearing as they should. Can't wait till they release the stable version :smile:
Aizaz Khaja
@aizkhaj
Nov 04 2015 03:22
@JPROFFICIAL stable version? Are you on a beta? (As I say that, note that I understand that even full releases can be buggy lol)
JPROFFICIAL
@JPROFFICIAL
Nov 04 2015 03:24
XCode 7 is still currently in beta-2 @metalhe4der
Aizaz Khaja
@aizkhaj
Nov 04 2015 03:25
Oh really? Hmm I thought Xcode 7 was the full release. Could it be that you're on a beta version, one yet to come of 7?
JPROFFICIAL
@JPROFFICIAL
Nov 04 2015 03:35
@metalhe4der I private messaged you to not clog this thread.
@spentak just a quick question - stuck on vid 118 with imageshack response, request, result - line 133 (ish) of your code && about the 26+ min mark of the video I am able to upload - but my result is FAILURE . (Just realialised that this was not a question!) could you please offer some wisdom / advice on how to solve this? I seem to be going around in circles with this. (love the course BTW)
Mark Price
@spentak
Nov 04 2015 16:41
@ktc what is the failure or air that you are getting
Error
JPROFFICIAL
@JPROFFICIAL
Nov 04 2015 18:09
@spentak any idea of what happened with my audio player code?
Mark Price
@spentak
Nov 04 2015 19:30
@JPROFFICIAL that nil error looks like its coming from the path
lol weird
@JPROFFICIAL
meaning you created an NSURL and force unwrapped it but it failed
NSURL will fail if you give it an invalid path
it would indicate to me that the music.mp3 is not in your project
or that you accidentally put it in xcassets
or for some reason, in the build settings->build phases->copy files your music.mp3 was not there
Ageel Shatry
@Ageel
Nov 04 2015 20:33
For the class, do we need to set up a new Apple ID, or can we use our existing one? This in reference to Lecture 5: Xcode Installation, where you tell us to go to developer.apple.com and setup a new Apple ID.
Jack Davis
@jackd942
Nov 04 2015 20:59
only if you don’t have one @Ageel
Ageel Shatry
@Ageel
Nov 04 2015 21:12
@jackd942 Thanks. Wasn't sure if we needed another one specifically for the developer account.
Jack Davis
@jackd942
Nov 04 2015 21:13
No problem…you can set up a new one if you wish, but if you already have one, you can use it.
Ageel Shatry
@Ageel
Nov 04 2015 21:13
Yeah, I think I'll just use my current one. Less of a hassle
JPROFFICIAL
@JPROFFICIAL
Nov 04 2015 21:33
@spentak it was in my resources folder, i copied it, deleted it, and recopied it in just to make sure it was valid. really stumped me.
Evan Leong
@evanmayo
Nov 04 2015 22:13
Hey @spentak , working on lecture 118 and I'm getting an error with the switch part of it. I cross referenced it with the code in the video and am still stumped. Any ideas?
Screen Shot 2015-11-04 at 2.12.11 PM.png
Mark Price
@spentak
Nov 04 2015 22:18
looking
@evanmayo could be due to you using Alamofire 3.0
Evan Leong
@evanmayo
Nov 04 2015 22:20
ah ok I'll try installing 2.0 and see if it works
thanks man
Mark Price
@spentak
Nov 04 2015 22:20
i suggest using 2.0 instead, or you can use the new updated method of working with Alamofire. one of the previous videos i did (i think for pokemon) showed the updated version
ill have to update this video
thanks for pointing it out
Evan Leong
@evanmayo
Nov 04 2015 22:21
oh cool - i'll try the updated method first. Np
Mark Price
@spentak
Nov 04 2015 22:22
yeah Alamofire's completion handler has been changed
itsalexbrown
@itsalexbrown
Nov 04 2015 22:26
about that... do you have any links that will help me understand completion handlers?
Mark Price
@spentak
Nov 04 2015 22:26
Jack Davis
@jackd942
Nov 04 2015 22:26
haha
itsalexbrown
@itsalexbrown
Nov 04 2015 22:27
hahaha awesome thanks!
Evan Leong
@evanmayo
Nov 04 2015 22:27
lmao awesome
Evan Leong
@evanmayo
Nov 04 2015 22:41
got it! for anyone that has this issue, with Alamofire 3.0 in lecture 118:
    }) {  encodingResult in

                        switch encodingResult {
                        case .Success(let upload, _, _):
                            upload.responseJSON(completionHandler: { response in
                                if let info = response.result.value as? Dictionary<String,AnyObject> {

                                    if let links = info["links"] as? Dictionary<String,AnyObject> {
                                        if let imageLink = links["image_link"] as? String {
                                            print("LINK: \(imageLink)")
                                        }

                                    }

                                }


                            })

                        case.Failure(let error):
                            print(error)
Mark Price
@spentak
Nov 04 2015 22:42
Boom!
@evanmayo can you post this as part of the Udemy discussion for me?
Evan Leong
@evanmayo
Nov 04 2015 22:42
you got it!
Mark Price
@spentak
Nov 04 2015 22:42
thanks
@spentak hey - thanks for the reply - when i print the result it is exactly that : FAILURE.
upload.responseJSON(completionHandler: { request, response, result in print("Result: \(result)")
console:
Result: FAILURE
The images upload ok though!