Trying to see my search results so I can properly format them, but I'm having trouble. I'm using the Yelp iOS API and it gives an example of what to call.
[self.client searchWithLocation:@"San Francisco, CA" completionHandler:^
(YLPSearch *search, NSError *error) {
// Perform any tasks you need to here
}];
Which seems simple enough. I'm coming from a JavaScript background so naturally I try a simple console.log
-esque of the the callback, but it seems to be outputting memory location data, and not anything readable by me.
[self.client searchWithLocation:@"San Francisco, CA"
completionHandler:^ (YLPSearch *search, NSError *error) {
NSLog(@"%@", search.businesses);
}];
// AppDelegate.h
#import <UIKit/UIKit.h>
#import <YelpAPI/YelpAPI.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
NS_ASSUME_NONNULL_BEGIN
@property (strong, nonatomic) UIWindow *window;
- (void)searchWithLocation:(NSString *)location
completionHandler:(YLPSearchCompletionHandler)completionHandler;
NS_ASSUME_NONNULL_END
@end
// AppDelegate.m
#import "AppDelegate.h"
@interface AppDelegate ()
@property (nonatomic, strong) YLPClient *client;
@end
@implementation AppDelegate
-(void)searchWithLocation:(NSString *)location
completionHandler:(YLPSearchCompletionHandler)completionHandler {
NSLog(@"I did a thing");
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[YLPClient authorizeWithAppId:@"jkdfhkdnfd"
secret:@"abcdefg123"
completionHandler:^
(YLPClient *client, NSError *error) {
// Save your newly authorized client
self.client = client;
[self.client searchWithLocation:@"San Francisco, CA"
completionHandler:^
(YLPSearch *search, NSError *error) {
NSLog(@"%@", search.businesses);
}];
}];
return YES;
}
Here's what it returns:
"<YLPBusiness: 0x6080000b5cc0>",
"<YLPBusiness: 0x6080000b5d20>",
"<YLPBusiness: 0x6080000b5d80>",
"<YLPBusiness: 0x6080000b5de0>",
"<YLPBusiness: 0x6080000b5e40>",
"<YLPBusiness: 0x6080000b5ea0>",
"<YLPBusiness: 0x6080000b5f00>",
"<YLPBusiness: 0x6080000b5f60>",
"<YLPBusiness: 0x6080000b5fc0>",
"<YLPBusiness: 0x6080000b6020>",
"<YLPBusiness: 0x6080000b6080>",
"<YLPBusiness: 0x6080000b60e0>",
"<YLPBusiness: 0x6080000b6140>",
"<YLPBusiness: 0x6080000b61a0>",
"<YLPBusiness: 0x6080000b6200>",
"<YLPBusiness: 0x6080000b6260>",
"<YLPBusiness: 0x6080000b62c0>",
"<YLPBusiness: 0x6080000b6320>",
"<YLPBusiness: 0x6080000b6380>",
"<YLPBusiness: 0x6080000b63e0>"