简体   繁体   English

在Objective-C中使用InstagramKit的问题

[英]Issue using InstagramKit in Objective-C

I am trying to use InstagramKit ( https://github.com/shyambhat/InstagramKit ) to build a simple app to help me learn objective-c. 我正在尝试使用InstagramKit( https://github.com/shyambhat/InstagramKit )构建一个简单的应用程序来帮助我学习Objective-C。

I am getting the following errors: 我收到以下错误:

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

...

Not sure what I am doing wrong. 不知道我在做什么错。

Here is my simple code I have tried. 这是我尝试过的简单代码。

MyViewController.m: 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: InstagramEngine.m:

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

It looks like you did not provide your Client ID. 您好像没有提供客户ID。 You need to update the InstagramKitAppClientId & InstagramKitAppRedirectURL settings in InstagramKit.plist with your values. 您需要使用您的值更新InstagramKit.plist中的InstagramKitAppClientId和InstagramKitAppRedirectURL设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM