Github API返回发布数组的空资产 [英] Github API Returns Empty Assets For Release Array
问题描述
我正在尝试通过gitHub api跟踪gitHub版本的download_count.我不需要太多,我只想看看它是什么.
I am trying to track the download_count of a gitHub release via the gitHub api. I don't need much, I just want to see what it is.
我正在尝试获取以下信息: http://developer.github. com/v3/repos/releases/#response
I'm trying to get this information: http://developer.github.com/v3/repos/releases/#response
从URL中可以看到,返回值包含一个"download_count"键,但不幸的是,我的资产数组完全为空.
As you can see from the URL, the return includes a "download_count" key, but unfortunately, my assets array is entirely empty.
使用此方法:
NSString * owner = @"...";
NSString * repo = @"...";
NSString * repoId = @"...";
// Get Release Info
NSString * releaseURL = [NSString stringWithFormat:@"https://api.github.com/repos/%@/%@/releases", owner, repo];
// Get Assets List Specifically
NSString * assetsURL = [NSString stringWithFormat:@"https://api.github.com/repos/%@/%@/releases/%@/assets", owner, repo, repoId];
NSURL * gitAssetsURL = [NSURL URLWithString:releaseURL];
NSData * gitAssetsRawData = [NSData dataWithContentsOfURL:gitAssetsURL];
NSString * gitDataString = [[NSString alloc] initWithData :gitAssetsRawData encoding:NSASCIIStringEncoding];
NSLog(@"%@", gitDataString);
一切正常,但我的资产数组始终为空.我确实有发布版本,并且所有存储库中的资产数组都是空的.
Everything outputs fine, but my assets array is always empty. I do have releases, and the assets array is empty on all of my repositories.
推荐答案
伊万(Ivan)在注释中回答了该问题,但只是为了结束问题,
Answered by Ivan in Comments, but just to close the question,
Ivan-资产是创建发行版时可以上传的二进制文件.请尝试创建发行版,然后查找通过在此处放置二进制文件或选择一个二进制文件来附加二进制文件."文本.我们仅跟踪这些资产的下载计数,而不跟踪释放自己(当前)."
Ivan - "Assets are binaries you can upload when creating a release. Try creating a release and look for the "Attach binaries by dropping them here or selecting one." text. We track download counts only for those assets, not for releases themselves (currently)."
这篇关于Github API返回发布数组的空资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!