我需要根据我运行的iOS版本重新配置一些UI,所以我需要一个检查iOS版本的好方法.暂时我这样做:
if ([[[UIDevice currentDevice] systemVersion] isEqualToString: @"7.0"]) {
//do stuff
}
Run Code Online (Sandbox Code Playgroud)
我不想硬编码这些字符串比较并根据它做出决定.有没有更好的方法来做到这一点?
我正在尝试NSLog我的一些枚举.例如,这段代码打印枚举的整数表示,但我希望它输出实际的字符串名称,在本例中为MON.我怎样才能做到这一点?
#import <Foundation/Foundation.h>
int main(void)
{
typedef enum {
SUN,
MON,
TUES
} DAYS;
DAYS d = MON;
NSLog(@"%@", d);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我是Objective C的新手,来自.NET和java背景.
所以我需要异步创建一些UIwebviews,我在自己的队列中使用
dispatch_queue_t queue = dispatch_queue_create("myqueue", NULL);
dispatch_async(queue, ^{
// create UIwebview, other things too
[self.view addSubview:webView];
});
Run Code Online (Sandbox Code Playgroud)
正如你所想象的那样会抛出一个错误:
bool _WebTryThreadLock(bool), 0xa1b8d70: Tried to obtain the web lock from a thread other
than the main thread or the web thread. This may be a result of calling to UIKit from a
secondary thread. Crashing now...
Run Code Online (Sandbox Code Playgroud)
那么如何在主线程上添加子视图呢?
使用iOS 8的应用程序并处理大量照片,我需要唯一识别PHassets但找不到任何要使用的属性?我发现了一处房产
PHObject/localIdentifier
Run Code Online (Sandbox Code Playgroud)
记录在这里
有没有办法在PHAsset上拥有唯一的ID?PHObject使用起来有点重.
我正在开发一个iOS应用程序,它将上传图像和视频,并按用户保存.我能够整合亚马逊s3并从iOS应用程序上传,我已经有一个node.js后端,我持有关于我在S3中保存的文件的meta和我从iOS返回的S3 Id.我的问题是:这是一个很好的架构,还是应该将S3保存活动移到后端?如果移动设备处理那个或后端,其他应用程序如何做(如instagram/vine)?
谢谢