使用Objective-C中的InstagramKit进行问题

时间:2015-01-17 13:30:04

标签: ios objective-c instagram

我正在尝试使用InstagramKit(https://github.com/shyambhat/InstagramKit)构建一个简单的应用程序来帮助我学习objective-c。

我收到以下错误:

2015-01-17 08:20:06.168 test[709:6529] *** Assertion failure in -[InstagramEngine init], /MY_FOLDER/test/InstagramKit/InstagramKit/Engine/InstagramEngine.m:146
2015-01-17 08:20:06.170 test[709:6529] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid Instagram Client ID.'
*** First throw call stack: (   
0   CoreFoundation      0x000000010e1a9f35 __exceptionPreprocess + 165  
1   libobjc.A.dylib     0x000000010de42bb7 objc_exception_throw + 45    
2   CoreFoundation      0x000000010e1a9d9a +[NSException raise:format:arguments:] + 106     
3   Foundation          0x000000010da5f5df -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195    
4   test                0x000000010c0b2bfd -[InstagramEngine init] + 2237
5   test                0x000000010c0b2162 __31+[InstagramEngine sharedEngine]_block_invoke + 50
6   libdispatch.dylib   0x000000010eaaf7f4 _dispatch_client_callout + 8     
7   libdispatch.dylib   0x000000010ea9c343 dispatch_once_f + 565
8   test                0x000000010c0b2109 +[InstagramEngine sharedEngine] + 89     
9   test

...

不确定我做错了什么。

这是我尝试的简单代码。

MyViewController.m:

- (void)viewDidLoad
{

    NSMutableArray *items = [NSMutableArray array];
    [super viewDidLoad];

    [[InstagramEngine sharedEngine] getMediaWithTagName:tag count:15 maxId:self.currentPaginationInfo.nextMaxId withSuccess:^(NSArray *media, InstagramPaginationInfo *paginationInfo) {
        self.currentPaginationInfo = paginationInfo;
        [items addObjectsFromArray:media];
    } failure:^(NSError *error) {
        NSLog(@"Search Media Failed");
    }];

}

===================

InstagramEngine.m:

NSString *const kInstagramKitAppClientIdConfigurationKey = @"MY_CLIENT_ID"; //@"InstagramKitAppClientId";
NSString *const kInstagramKitAppRedirectUrlConfigurationKey = @"MY_REDIRECT_URL"; //@"InstagramKitAppRedirectURL";

1 个答案:

答案 0 :(得分:2)

您好像没有提供您的客户ID。你需要更新InstagramKitAppClientId& InstagramKit.plist中的InstagramKitAppRedirectURL设置与您的值。