小编Loc*_*ham的帖子

OpenWeatherMap返回错误的当前天气

我正在尝试实现一个iPhone应用程序,我正在集成OpenWeatherMap来检索当前的天气.但是,我注意到返回的数据不正确(大约39华氏度).

下面是我用于使用Lan/Lon坐标检索Denver,Usa的当前天气的JSON URL,其中xxxxxxxxxxxxx是我的APPID密钥.

http://api.openweathermap.org/data/2.5/weather?APPID=xxxxxxxxxxxxx&lat=39.738539&lon=-104.981114
Run Code Online (Sandbox Code Playgroud)

返回的温度为291.05988.从文档读取,这个温度单位是​​开尔文.所以为了转换为Fahrenhiet,我采取291.05988 - 254.928 = 36.13188华氏度.然而,真正的当前天气是75华氏度.这是约39度.

请告诉我我做错了什么.

谢谢Loc

json weather weather-api openweathermap

5
推荐指数
2
解决办法
5941
查看次数

从iCloud备份中排除:NSURLIsExcludedFromBackupKey

我的应用程序第二次被拒绝,我失去了3周:(

第一次提交,我排除了只有DIRECTORIES在iCloud中备份.苹果拒绝......

第二次提交,我排除了在iCloud中备份下载的DIRECTORIES&PICTURES.苹果公司再次拒绝了......苹果公司还抱怨我的应用内购买没有"恢复"功能,而事实上,我确实有一个"恢复"按钮,当我测试它时它就可以工作了.

我已经完成了Apple的建议,将文件排除在使用NSURLIsExcludedFromBackupKey进行备份.Macmade's在stackoverflow上发表了一篇有趣的评论:

有时,Apple审核人员认为您的数据可以重新生成,而不是.然后,您必须解释为什么必须备份数据

审稿人多久经常误解,我们必须向他们解释内容是否需要离线而不能重新生成?

这是我用来从iCloud中排除我的文件和目录的代码.你发现任何问题吗?

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    // There's a chance the download failed, but don't assert here
    //assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);

    NSError *error = nil;
    BOOL success = [URL setResourceValue:[NSNumber numberWithBool:YES]
                                  forKey:NSURLIsExcludedFromBackupKey
                                   error: &error];
    if(!success){
        NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
    }
    return success;
}

//Download picture from Google and exclude it from being backed-up in iCloud
- (void)downloadFetcher:(GTMHTTPFetcher *)fetcher
       finishedWithData:(NSData *)data
                  error:(NSError *)error
{

    if (error == nil) …
Run Code Online (Sandbox Code Playgroud)

ios icloud

5
推荐指数
1
解决办法
6191
查看次数

标签 统计

icloud ×1

ios ×1

json ×1

openweathermap ×1

weather ×1

weather-api ×1