#import <UIKit/UIKit.h>@interface AppDelegate : UIResponder <UIApplicationDelegate>@property (strong, nonatomic) UIWindow *window;@end#import"AppDelegate.h"#import"MovieHomeController.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {self.window = [[UIWindow alloc] initWithFrame:[[...
//手机序列号 NSString* identifierNumber = [[UIDevice currentDevice] uniqueIdentifier]; NSLog(@"手机序列号: %@",identifierNumber); //手机别名: 用户定义的名称 NSString* userPhoneName = [[UIDevice currentDevice] name]; NSLog(@"手机别名: %@", userPhoneName); //设备名称 NSString* deviceName = [[UIDevice currentDevice] systemName]; NSLog(@"设备名称: %@",deviceName ); ...
进入正题 获取系统通讯录,不想多讲,留下链接http://my.oschina.net/joanfen/blog/140146通常做法:首先创建一个ABAddressBookRef类的对象addressBooks,然后获取系统权限,获取权限的代码:// 获取系统权限,并获得通讯录内容存入addressBooks。ABAddressBookRef addressBooks = nil;addressBooks = ABAddressBookCreateWithOptions(NULL, NULL);dispatch_semaphore_t sema = dispatch_semaphore_create(0);ABAddressBookRequest...
http://blog.csdn.net/betterbb/article/details/25984455 FMDB存储字典或数组时会变成字符串存入sqlite里,但如果不将其转换成json格式存储,你查询获取数据时就会获取无法转换成字典或数组的字符串。转换JSON存储: NSArray *picArr = (NSArray *)dic[@"pic"]; NSError *err = nil; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:picArroptions:NSJSONWritingPrettyPrinted error:&err]; NS...
ios获取权限by 伍雪颖-(void)requestRecord{[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {dispatch_async(dispatch_get_main_queue(), ^{});}];
}-(void)requestAccessEventWithType:(EKEntityType)eventType{[[EKEventStore new] requestAccessToEntityType:eventType completion:^(BOOL granted, NSError *error) {dispatch_async(dispatch_get_main_queue(), ^{});}];
}- (void)requestAccessSo...
1.添加代理UIImagePickerControllerDelegate 2.设置点击跳转事件- (IBAction)picButton:(UIButton *)sender { NSLog(@"我的相册"); if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){ //a.初始化相册拾取器 UIImagePickerController *controller = [[UIImagePickerController alloc] init]; //b.设置代理 controller.delegate = self; ...
原文链接:iOS键盘弹出高度以及动画时间获取 简书主页:http://www.jianshu.com/users/37f2920f6848Github主页:https://github.com/MajorLMJiOS开发者公会-技术1群 QQ群号:87440292iOS开发者公会-技术2群 QQ群号:232702419iOS开发者公会-议事区 QQ群号:413102158 原文:http://www.cnblogs.com/lmj123/p/5829119.html
UDID被弃用,使用UUID来作为设备的唯一标识。获取到UUID后,如果用NSUserDefaults存储,当程序被卸载后重装时,再获得的UUID和之前就不同了。使用keychain存储可以保证程序卸载重装时,UUID不变。但当刷机或者升级系统后,UUID还是会改变的。但这仍是目前为止最佳的解决办法了,如果有更好的解决办法,欢迎留言。(我整理的解决办法的参考来源:http://blog.k-res.net/archives/1081.html)给大家两个类: UUID.h中的代码: #impor...
GetCodeViewController仿某某获取验证码,并验证方式。提供很多自定义接口,高度自定义。也可以自己更改源代码,界面用xib文件,加自动布局实现,直观易懂。运行项目,请先cd到该目录后,pod update一下,即可运行,因为用到了POP动画库。用法将 项目中 popCodeViewController 整个文件夹拖到你的项目里面。导入依赖库POP动画库自定义控制器中,导入GetCodeViewController、PresentingAnimator、DismissingAnimator类自定义控制器中...
1.访问音乐库的两种方法,如下图(只能访问音频文件,如music,podcast,audiobook等)2.MPMusicPlayerController的使用有两种播放器可以选择,一种是application music player,另外一种是iPod music player。第一种播放器是一种内部播放器,当程序对出后停止播放;而第二种播放器则与iPod播放器内的信息相关,退出之后不会停止播放。获取方式如下: + applicationMusicPlayer+ iPodMusicPlayer 播放之前需要设置播放器的播放...
在开发中,需要获取当前设备的一些信息,可以通过UIDevice,NSbundle,NSlocale获取.UIDeviceUIDevice 提供了多种属性,类函数及状态通知,可以检测手机电量,定位,感应,机型,当前系统版本等等.//设备相关信息的获取 NSString *strName = [[UIDevice currentDevice] name]; NSLog(@"设备名称:%@", strName);//e.g. "My iPhone" NSString *strSysName = [[UIDevice currentDevice] systemName]; NSLog(@"系统名称:%@", strSysName);/...
1int webHeight = [[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.scrollHeight"] intValue]; 原文:http://www.cnblogs.com/sun-wsh/p/6065055.html
iOS 最常见的获取系统版本的方法是:
[[[UIDevice currentDevice] systemVersion] floatValue]可是。这个floatValue是不靠谱的,这也算是iOS SDK的一个bug吧。看一下上面的函数在8.2系统上的表现。假设代码中有 if( version >= 8.2) 的推断,则该推断会失效。所以,还是使用字符串对照版本比較靠谱。原文:http://www.cnblogs.com/wzzkaifa/p/6853190.html
#import "sys/utsname.h"/** * 设备版本 * * @return e.g. iPhone 5S */+ (NSString*)deviceVersion { // 需要#import "sys/utsname.h" struct utsname systemInfo; uname(&systemInfo); NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; //iPhone if ([deviceString isEqualToString:@"iPhone1,1"]) return @"iPhone 1G"; if ([deviceSt...
标题:IOS8解决获取位置坐标信息出错(Error Domain=kCLErrorDomain Code=0) 前几天解决了在ios8上无法使用地址位置服务的问题,最近在模拟器上调试发现获取位置坐标信息的时候会报错,错误信息: didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLErrorDomain error 0.)”。出错原因是xcode里面的project-->scheme-->edit scheme-->options-->core location-->allow location...