Yelp API sample...help with Yelp integration on iPhone.

Discussion in 'iOS Programming' started by noobcodered, Jul 8, 2016.

  1. noobcodered macrumors newbie

    Joined:
    Jan 29, 2016
    #1
    I've been trying to integrate the Yelp API into my app to populate a table view with nearby listings. After grabbing the sample Obj-C code and installing the pods, everything works fine. However, I wasn't aware that there was a special way in which Yelp intended for the mobile API to be implemented. I found their sample iOS project here: https://github.com/Yelp/yelp-ios and after some issues with Frameworks and pods, I managed to get the project to run. I had to find some of the Frameworks myself and drag them into the project. Now I can get the app to run up to the first Table View in the attached image, but clicking any of the search choices throws a generic NSException error. Considering this is sample code directly from Yelp, I'm pretty disappointed that I have to mess with so many things just to get it to run, let alone get it to work right. Am I missing something? I made sure my repo was updated, I have the pods installed. I've checked the storyboard for obvious errors, but there are so many code files I don't even know where to start.

    Any help would be appreciated.
     

    Attached Files:

  2. Dookieman macrumors 6502

    Joined:
    Oct 12, 2009
    #2
    Well, with just looking at your image, it looks like there is a method that wants a request of some sort (most likely a NSURLRequest). If you click on that bar between your code editor and console log, you can see the previous method where the app crashed. Start there and work your way back.
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    This is a SIGABRT runtime exception. This is due to Apple's engineers trying to help you. They believe the code has made an error and they are telling you about it as soon as the error is detected.

    The text at the top of the stack trace is Apple's message to you: "Terminating app ..." "reason: Cannot create task from nil request".

    Looking at the stack trace the request it's talking about is a NSURLRequest that was supposed to be passed to the method [NSURLSession dataTaskForRequest:completion:] and it was called in the method: [YLPClient queryWithRequest:completionHandler]. As the assertion says, the code has passed nil instead of a valid request.

    I would suggest setting a breakpoint in that method and then you can see why the request is nil.
     

Share This Page