├── NNDeviceInformation.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcuserdata │ └── liupengkun.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── NNDeviceInformation.xcscheme └── project.pbxproj ├── NNDeviceInformation ├── NNViewController.h ├── NNDeviceInformation.xcdatamodeld │ ├── .xccurrentversion │ └── NNDeviceInformation.xcdatamodel │ │ └── contents ├── NNTableViewCell.h ├── main.m ├── AppDelegate.h ├── NNTableViewCell.m ├── NNDeviceInformation │ ├── NNDeviceInformation.h │ └── NNDeviceInformation.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── NNViewController.m ├── NNTableViewCell.xib └── AppDelegate.m ├── NNDeviceInformationTests ├── Info.plist └── NNDeviceInformationTests.m ├── LICENSE └── README.md /NNDeviceInformation.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NNViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNDeviceInformation.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | NNDeviceInformation.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNDeviceInformation.xcdatamodeld/NNDeviceInformation.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // NNTableViewCell.h 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NNTableViewCell : UITableViewCell 12 | @property (nonatomic, copy) NSString *nameString; 13 | @property (nonatomic, copy) NSString *infoString; 14 | @end 15 | -------------------------------------------------------------------------------- /NNDeviceInformation/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /NNDeviceInformation/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @property (readonly, strong) NSPersistentContainer *persistentContainer; 17 | 18 | - (void)saveContext; 19 | 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /NNDeviceInformation.xcodeproj/xcuserdata/liupengkun.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /NNDeviceInformationTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // NNTableViewCell.m 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import "NNTableViewCell.h" 10 | 11 | @interface NNTableViewCell() 12 | @property (weak, nonatomic) IBOutlet UILabel *nameLabel; 13 | @property (weak, nonatomic) IBOutlet UILabel *infoLabel; 14 | @end 15 | 16 | @implementation NNTableViewCell 17 | 18 | - (void)awakeFromNib { 19 | [super awakeFromNib]; 20 | } 21 | 22 | - (void)layoutSubviews { 23 | self.infoLabel.text = [NSString stringWithFormat:@"%@", self.infoString]; 24 | self.nameLabel.text = [NSString stringWithFormat:@"%@", self.nameString]; 25 | } 26 | 27 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 28 | [super setSelected:selected animated:animated]; 29 | 30 | // Configure the view for the selected state 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 以梦为马 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NNDeviceInformationTests/NNDeviceInformationTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NNDeviceInformationTests.m 3 | // NNDeviceInformationTests 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NNDeviceInformationTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NNDeviceInformationTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNDeviceInformation/NNDeviceInformation.h: -------------------------------------------------------------------------------- 1 | // 2 | // NNDeviceInformation.h 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NNDeviceInformation : NSObject 12 | /// 屏幕宽度 13 | + (CGFloat)getDeviceScreenWidth; 14 | 15 | /// 屏幕高度 16 | + (CGFloat)getDeviceScreenHeight; 17 | 18 | /// 获取设备版本号 19 | + (NSString *)getDeviceName; 20 | 21 | /// 获取iPhone名称 22 | + (NSString *)getiPhoneName; 23 | 24 | /// 获取app版本号 25 | + (NSString *)getAPPVerion; 26 | 27 | /// 获取电池电量 28 | + (CGFloat)getBatteryLevel; 29 | 30 | /// 当前系统名称 31 | + (NSString *)getSystemName; 32 | 33 | /// 当前系统版本号 34 | + (NSString *)getSystemVersion; 35 | 36 | /// 通用唯一识别码UUID 37 | + (NSString *)getUUID; 38 | 39 | /// 获取当前设备IP 40 | + (NSString *)getDeviceIPAdress; 41 | 42 | /// 获取总内存大小 43 | + (long long)getTotalMemorySize; 44 | 45 | /// 获取当前可用内存 46 | + (long long)getAvailableMemorySize; 47 | 48 | /// 获取精准电池电量 49 | + (CGFloat)getCurrentBatteryLevel; 50 | 51 | /// 获取电池当前的状态,共有4种状态 52 | + (NSString *) getBatteryState; 53 | 54 | /// 获取当前语言 55 | + (NSString *)getDeviceLanguage; 56 | @end 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NNDeviceInformation 2 | ### iOS 获取设备的各种信息。 3 | #### 以下是所有所有方法,直接调用即可: 4 | 5 | ``` 6 | @interface NNDeviceInformation : NSObject 7 | /// 屏幕宽度 8 | + (CGFloat)getDeviceScreenWidth; 9 | 10 | /// 屏幕高度 11 | + (CGFloat)getDeviceScreenHeight; 12 | 13 | /// 获取设备版本号 14 | + (NSString *)getDeviceName; 15 | 16 | /// 获取iPhone名称 17 | + (NSString *)getiPhoneName; 18 | 19 | /// 获取app版本号 20 | + (NSString *)getAPPVerion; 21 | 22 | /// 获取电池电量 23 | + (CGFloat)getBatteryLevel; 24 | 25 | /// 当前系统名称 26 | + (NSString *)getSystemName; 27 | 28 | /// 当前系统版本号 29 | + (NSString *)getSystemVersion; 30 | 31 | /// 通用唯一识别码UUID 32 | + (NSString *)getUUID; 33 | 34 | /// 获取当前设备IP 35 | + (NSString *)getDeviceIPAdress; 36 | 37 | /// 获取总内存大小 38 | + (long long)getTotalMemorySize; 39 | 40 | /// 获取当前可用内存 41 | + (long long)getAvailableMemorySize; 42 | 43 | /// 获取精准电池电量 44 | + (CGFloat)getCurrentBatteryLevel; 45 | 46 | /// 获取电池当前的状态,共有4种状态 47 | + (NSString *) getBatteryState; 48 | 49 | /// 获取当前语言 50 | + (NSString *)getDeviceLanguage; 51 | @end 52 | ``` 53 | 54 | ### License 55 | 56 | This repositorie is released under the under [MIT License](https://github.com/liuzhongning/NNDeviceInformation/blob/master/LICENSE) 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /NNDeviceInformation/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /NNDeviceInformation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /NNDeviceInformation/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /NNDeviceInformation/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import "NNViewController.h" 10 | #import "NNTableViewCell.h" 11 | #import "NNDeviceInformation.h" 12 | 13 | static NSString *tableViewCellID = @"NNTableViewCellID"; 14 | 15 | @interface NNViewController () 16 | @property (nonatomic,strong) UITableView *tableView; 17 | @property (nonatomic, strong) NSArray *infoArray; 18 | @property (nonatomic, strong) NSArray *nameArray; 19 | @end 20 | 21 | @implementation NNViewController 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | self.title = @"设备信息"; 25 | [self.view addSubview:self.tableView]; 26 | } 27 | 28 | #pragma mark - UITableViewDataSource 29 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 30 | return self.infoArray.count; 31 | } 32 | 33 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 34 | NNTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:tableViewCellID forIndexPath:indexPath]; 35 | cell.nameString = self.nameArray[indexPath.row]; 36 | cell.infoString = self.infoArray[indexPath.row]; 37 | return cell; 38 | } 39 | 40 | #pragma mark - UITableViewDelegate 41 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 42 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 43 | } 44 | 45 | #pragma mark - LazyLoading 46 | - (UITableView *)tableView { 47 | if (!_tableView) { 48 | _tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain]; 49 | _tableView.delegate = self; 50 | _tableView.dataSource = self; 51 | _tableView.showsVerticalScrollIndicator = NO; 52 | _tableView.rowHeight = 60; 53 | _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 54 | 55 | [_tableView registerNib:[UINib nibWithNibName:@"NNTableViewCell" bundle:nil] forCellReuseIdentifier:tableViewCellID]; 56 | } 57 | return _tableView; 58 | } 59 | 60 | - (NSArray *)infoArray { 61 | if (!_infoArray) { 62 | _infoArray = [NSArray arrayWithObjects: 63 | @([NNDeviceInformation getDeviceScreenWidth]), 64 | @([NNDeviceInformation getDeviceScreenHeight]), 65 | [NNDeviceInformation getDeviceName], 66 | [NNDeviceInformation getiPhoneName], 67 | [NNDeviceInformation getAPPVerion], 68 | @([NNDeviceInformation getBatteryLevel]), 69 | [NNDeviceInformation getSystemName], 70 | [NNDeviceInformation getSystemVersion], 71 | [NNDeviceInformation getUUID], 72 | [NNDeviceInformation getDeviceIPAdress], 73 | @([NNDeviceInformation getTotalMemorySize]), 74 | @([NNDeviceInformation getAvailableMemorySize]), 75 | @([NNDeviceInformation getCurrentBatteryLevel]), 76 | [NNDeviceInformation getBatteryState], 77 | [NNDeviceInformation getDeviceLanguage], nil]; 78 | } 79 | return _infoArray; 80 | } 81 | 82 | - (NSArray *)nameArray { 83 | if (!_nameArray) { 84 | _nameArray = [NSArray arrayWithObjects: 85 | @"屏幕宽度", 86 | @"屏幕高度", 87 | @"设备版本号", 88 | @"iPhone名称", 89 | @"app版本号", 90 | @"电池电量", 91 | @"当前系统名称", 92 | @"当前系统版本号", 93 | @"识别码UUID", 94 | @"当前设备IP", 95 | @"总内存大小", 96 | @"当前可用内存", 97 | @"精准电池电量", 98 | @"电池当前的状态", 99 | @"当前语言", nil]; 100 | } 101 | return _nameArray; 102 | } 103 | @end 104 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /NNDeviceInformation.xcodeproj/xcuserdata/liupengkun.xcuserdatad/xcschemes/NNDeviceInformation.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /NNDeviceInformation/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | // Saves changes in the application's managed object context before the application terminates. 49 | [self saveContext]; 50 | } 51 | 52 | 53 | #pragma mark - Core Data stack 54 | 55 | @synthesize persistentContainer = _persistentContainer; 56 | 57 | - (NSPersistentContainer *)persistentContainer { 58 | // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. 59 | @synchronized (self) { 60 | if (_persistentContainer == nil) { 61 | _persistentContainer = [[NSPersistentContainer alloc] initWithName:@"NNDeviceInformation"]; 62 | [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) { 63 | if (error != nil) { 64 | // Replace this implementation with code to handle the error appropriately. 65 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 66 | 67 | /* 68 | Typical reasons for an error here include: 69 | * The parent directory does not exist, cannot be created, or disallows writing. 70 | * The persistent store is not accessible, due to permissions or data protection when the device is locked. 71 | * The device is out of space. 72 | * The store could not be migrated to the current model version. 73 | Check the error message to determine what the actual problem was. 74 | */ 75 | NSLog(@"Unresolved error %@, %@", error, error.userInfo); 76 | abort(); 77 | } 78 | }]; 79 | } 80 | } 81 | 82 | return _persistentContainer; 83 | } 84 | 85 | #pragma mark - Core Data Saving support 86 | 87 | - (void)saveContext { 88 | NSManagedObjectContext *context = self.persistentContainer.viewContext; 89 | NSError *error = nil; 90 | if ([context hasChanges] && ![context save:&error]) { 91 | // Replace this implementation with code to handle the error appropriately. 92 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 93 | NSLog(@"Unresolved error %@, %@", error, error.userInfo); 94 | abort(); 95 | } 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /NNDeviceInformation/NNDeviceInformation/NNDeviceInformation.m: -------------------------------------------------------------------------------- 1 | // 2 | // NNDeviceInformation.m 3 | // NNDeviceInformation 4 | // 5 | // Created by 刘朋坤 on 17/4/7. 6 | // Copyright © 2017年 刘朋坤. All rights reserved. 7 | // 8 | 9 | #import "NNDeviceInformation.h" 10 | #import "sys/utsname.h" 11 | #import 12 | #import 13 | #import 14 | #include 15 | 16 | @implementation NNDeviceInformation 17 | 18 | /// 屏幕宽度 19 | + (CGFloat)getDeviceScreenWidth { 20 | return [UIScreen mainScreen].bounds.size.width; 21 | } 22 | 23 | /// 屏幕高度 24 | + (CGFloat)getDeviceScreenHeight { 25 | return [UIScreen mainScreen].bounds.size.height; 26 | } 27 | 28 | /// 获取设备版本号 29 | + (NSString *)getDeviceName { 30 | // 需要#import "sys/utsname.h" 31 | struct utsname systemInfo; 32 | uname(&systemInfo); 33 | NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; 34 | 35 | if ([deviceString isEqualToString:@"iPhone3,1"]) return @"iPhone 4"; 36 | if ([deviceString isEqualToString:@"iPhone3,2"]) return @"iPhone 4"; 37 | if ([deviceString isEqualToString:@"iPhone3,3"]) return @"iPhone 4"; 38 | if ([deviceString isEqualToString:@"iPhone4,1"]) return @"iPhone 4S"; 39 | if ([deviceString isEqualToString:@"iPhone5,1"]) return @"iPhone 5"; 40 | if ([deviceString isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (GSM+CDMA)"; 41 | if ([deviceString isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM)"; 42 | if ([deviceString isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (GSM+CDMA)"; 43 | if ([deviceString isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM)"; 44 | if ([deviceString isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (GSM+CDMA)"; 45 | if ([deviceString isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus"; 46 | if ([deviceString isEqualToString:@"iPhone7,2"]) return @"iPhone 6"; 47 | if ([deviceString isEqualToString:@"iPhone8,1"]) return @"iPhone 6s"; 48 | if ([deviceString isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus"; 49 | if ([deviceString isEqualToString:@"iPhone8,4"]) return @"iPhone SE"; 50 | 51 | if ([deviceString isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G"; 52 | if ([deviceString isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G"; 53 | if ([deviceString isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G"; 54 | if ([deviceString isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G"; 55 | if ([deviceString isEqualToString:@"iPod5,1"]) return @"iPod Touch (5 Gen)"; 56 | 57 | if ([deviceString isEqualToString:@"iPad1,1"]) return @"iPad"; 58 | if ([deviceString isEqualToString:@"iPad1,2"]) return @"iPad 3G"; 59 | if ([deviceString isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)"; 60 | if ([deviceString isEqualToString:@"iPad2,2"]) return @"iPad 2"; 61 | if ([deviceString isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)"; 62 | if ([deviceString isEqualToString:@"iPad2,4"]) return @"iPad 2"; 63 | if ([deviceString isEqualToString:@"iPad2,5"]) return @"iPad Mini (WiFi)"; 64 | if ([deviceString isEqualToString:@"iPad2,6"]) return @"iPad Mini"; 65 | if ([deviceString isEqualToString:@"iPad2,7"]) return @"iPad Mini (GSM+CDMA)"; 66 | if ([deviceString isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)"; 67 | if ([deviceString isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)"; 68 | if ([deviceString isEqualToString:@"iPad3,3"]) return @"iPad 3"; 69 | if ([deviceString isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)"; 70 | if ([deviceString isEqualToString:@"iPad3,5"]) return @"iPad 4"; 71 | if ([deviceString isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)"; 72 | if ([deviceString isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)"; 73 | if ([deviceString isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)"; 74 | if ([deviceString isEqualToString:@"iPad4,4"]) return @"iPad Mini 2 (WiFi)"; 75 | if ([deviceString isEqualToString:@"iPad4,5"]) return @"iPad Mini 2 (Cellular)"; 76 | if ([deviceString isEqualToString:@"iPad4,6"]) return @"iPad Mini 2"; 77 | if ([deviceString isEqualToString:@"iPad4,7"]) return @"iPad Mini 3"; 78 | if ([deviceString isEqualToString:@"iPad4,8"]) return @"iPad Mini 3"; 79 | if ([deviceString isEqualToString:@"iPad4,9"]) return @"iPad Mini 3"; 80 | if ([deviceString isEqualToString:@"iPad5,1"]) return @"iPad Mini 4 (WiFi)"; 81 | if ([deviceString isEqualToString:@"iPad5,2"]) return @"iPad Mini 4 (LTE)"; 82 | if ([deviceString isEqualToString:@"iPad5,3"]) return @"iPad Air 2"; 83 | if ([deviceString isEqualToString:@"iPad5,4"]) return @"iPad Air 2"; 84 | if ([deviceString isEqualToString:@"iPad6,3"]) return @"iPad Pro 9.7"; 85 | if ([deviceString isEqualToString:@"iPad6,4"]) return @"iPad Pro 9.7"; 86 | if ([deviceString isEqualToString:@"iPad6,7"]) return @"iPad Pro 12.9"; 87 | if ([deviceString isEqualToString:@"iPad6,8"]) return @"iPad Pro 12.9"; 88 | 89 | if ([deviceString isEqualToString:@"i386"]) return @"Simulator"; 90 | if ([deviceString isEqualToString:@"x86_64"]) return @"Simulator"; 91 | 92 | return deviceString; 93 | } 94 | 95 | /// 获取iPhone名称 96 | + (NSString *)getiPhoneName { 97 | return [UIDevice currentDevice].name; 98 | } 99 | 100 | /// 获取app版本号 101 | + (NSString *)getAPPVerion { 102 | return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; 103 | } 104 | 105 | /// 获取电池电量 106 | + (CGFloat)getBatteryLevel { 107 | return [UIDevice currentDevice].batteryLevel; 108 | } 109 | 110 | /// 当前系统名称 111 | + (NSString *)getSystemName { 112 | return [UIDevice currentDevice].systemName; 113 | } 114 | 115 | /// 当前系统版本号 116 | + (NSString *)getSystemVersion { 117 | return [UIDevice currentDevice].systemVersion; 118 | } 119 | 120 | /// 通用唯一识别码UUID 121 | + (NSString *)getUUID { 122 | return [[UIDevice currentDevice] identifierForVendor].UUIDString; 123 | } 124 | 125 | // 获取当前设备IP 126 | + (NSString *)getDeviceIPAdress { 127 | NSString *address = @"an error occurred when obtaining ip address"; 128 | struct ifaddrs *interfaces = NULL; 129 | struct ifaddrs *temp_addr = NULL; 130 | int success = 0; 131 | 132 | success = getifaddrs(&interfaces); 133 | 134 | if (success == 0) { // 0 表示获取成功 135 | 136 | temp_addr = interfaces; 137 | while (temp_addr != NULL) { 138 | if( temp_addr->ifa_addr->sa_family == AF_INET) { 139 | // Check if interface is en0 which is the wifi connection on the iPhone 140 | if ([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"]) { 141 | // Get NSString from C String 142 | address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)]; 143 | } 144 | } 145 | temp_addr = temp_addr->ifa_next; 146 | } 147 | } 148 | 149 | freeifaddrs(interfaces); 150 | return address; 151 | } 152 | 153 | /// 获取总内存大小 154 | + (long long)getTotalMemorySize { 155 | return [NSProcessInfo processInfo].physicalMemory; 156 | } 157 | 158 | /// 获取当前可用内存 159 | + (long long)getAvailableMemorySize { 160 | vm_statistics_data_t vmStats; 161 | mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; 162 | kern_return_t kernReturn = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmStats, &infoCount); 163 | if (kernReturn != KERN_SUCCESS) 164 | { 165 | return NSNotFound; 166 | } 167 | 168 | return ((vm_page_size * vmStats.free_count + vm_page_size * vmStats.inactive_count)); 169 | } 170 | 171 | /// 获取精准电池电量 172 | + (CGFloat)getCurrentBatteryLevel { 173 | UIApplication *app = [UIApplication sharedApplication]; 174 | if (app.applicationState == UIApplicationStateActive||app.applicationState==UIApplicationStateInactive) { 175 | Ivar ivar= class_getInstanceVariable([app class],"_statusBar"); 176 | id status = object_getIvar(app, ivar); 177 | for (id aview in [status subviews]) { 178 | int batteryLevel = 0; 179 | for (id bview in [aview subviews]) { 180 | if ([NSStringFromClass([bview class]) caseInsensitiveCompare:@"UIStatusBarBatteryItemView"] == NSOrderedSame&&[[[UIDevice currentDevice] systemVersion] floatValue] >=6.0) { 181 | 182 | Ivar ivar= class_getInstanceVariable([bview class],"_capacity"); 183 | if(ivar) { 184 | batteryLevel = ((int (*)(id, Ivar))object_getIvar)(bview, ivar); 185 | if (batteryLevel > 0 && batteryLevel <= 100) { 186 | return batteryLevel; 187 | 188 | } else { 189 | return 0; 190 | } 191 | } 192 | } 193 | } 194 | } 195 | } 196 | 197 | return 0; 198 | } 199 | 200 | /// 获取电池当前的状态,共有4种状态 201 | + (NSString *) getBatteryState { 202 | UIDevice *device = [UIDevice currentDevice]; 203 | if (device.batteryState == UIDeviceBatteryStateUnknown) { 204 | return @"UnKnow"; 205 | } else if (device.batteryState == UIDeviceBatteryStateUnplugged){ 206 | return @"Unplugged"; 207 | } else if (device.batteryState == UIDeviceBatteryStateCharging){ 208 | return @"Charging"; 209 | } else if (device.batteryState == UIDeviceBatteryStateFull){ 210 | return @"Full"; 211 | } 212 | return nil; 213 | } 214 | 215 | /// 获取当前语言 216 | + (NSString *)getDeviceLanguage { 217 | NSArray *languageArray = [NSLocale preferredLanguages]; 218 | return [languageArray objectAtIndex:0]; 219 | } 220 | 221 | 222 | @end 223 | 224 | -------------------------------------------------------------------------------- /NNDeviceInformation.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E3C8C52C1E977E6500067BF1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E3C8C52B1E977E6500067BF1 /* main.m */; }; 11 | E3C8C52F1E977E6500067BF1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E3C8C52E1E977E6500067BF1 /* AppDelegate.m */; }; 12 | E3C8C5321E977E6500067BF1 /* NNViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E3C8C5311E977E6500067BF1 /* NNViewController.m */; }; 13 | E3C8C5351E977E6500067BF1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E3C8C5331E977E6500067BF1 /* Main.storyboard */; }; 14 | E3C8C5381E977E6500067BF1 /* NNDeviceInformation.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = E3C8C5361E977E6500067BF1 /* NNDeviceInformation.xcdatamodeld */; }; 15 | E3C8C53A1E977E6500067BF1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E3C8C5391E977E6500067BF1 /* Assets.xcassets */; }; 16 | E3C8C53D1E977E6500067BF1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E3C8C53B1E977E6500067BF1 /* LaunchScreen.storyboard */; }; 17 | E3C8C5481E977E6500067BF1 /* NNDeviceInformationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E3C8C5471E977E6500067BF1 /* NNDeviceInformationTests.m */; }; 18 | E3C8C5581E977EB700067BF1 /* NNDeviceInformation.m in Sources */ = {isa = PBXBuildFile; fileRef = E3C8C5571E977EB700067BF1 /* NNDeviceInformation.m */; }; 19 | E3C8C55C1E9783A300067BF1 /* NNTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E3C8C55A1E9783A300067BF1 /* NNTableViewCell.m */; }; 20 | E3C8C55D1E9783A300067BF1 /* NNTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E3C8C55B1E9783A300067BF1 /* NNTableViewCell.xib */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | E3C8C5441E977E6500067BF1 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = E3C8C51F1E977E6500067BF1 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = E3C8C5261E977E6500067BF1; 29 | remoteInfo = NNDeviceInformation; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | E3C8C5271E977E6500067BF1 /* NNDeviceInformation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NNDeviceInformation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | E3C8C52B1E977E6500067BF1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | E3C8C52D1E977E6500067BF1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | E3C8C52E1E977E6500067BF1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | E3C8C5301E977E6500067BF1 /* NNViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NNViewController.h; sourceTree = ""; }; 39 | E3C8C5311E977E6500067BF1 /* NNViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NNViewController.m; sourceTree = ""; }; 40 | E3C8C5341E977E6500067BF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | E3C8C5371E977E6500067BF1 /* NNDeviceInformation.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = NNDeviceInformation.xcdatamodel; sourceTree = ""; }; 42 | E3C8C5391E977E6500067BF1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | E3C8C53C1E977E6500067BF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | E3C8C53E1E977E6500067BF1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | E3C8C5431E977E6500067BF1 /* NNDeviceInformationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NNDeviceInformationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | E3C8C5471E977E6500067BF1 /* NNDeviceInformationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NNDeviceInformationTests.m; sourceTree = ""; }; 47 | E3C8C5491E977E6500067BF1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | E3C8C5561E977EB700067BF1 /* NNDeviceInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NNDeviceInformation.h; sourceTree = ""; }; 49 | E3C8C5571E977EB700067BF1 /* NNDeviceInformation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NNDeviceInformation.m; sourceTree = ""; }; 50 | E3C8C5591E9783A300067BF1 /* NNTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NNTableViewCell.h; sourceTree = ""; }; 51 | E3C8C55A1E9783A300067BF1 /* NNTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NNTableViewCell.m; sourceTree = ""; }; 52 | E3C8C55B1E9783A300067BF1 /* NNTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NNTableViewCell.xib; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | E3C8C5241E977E6500067BF1 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | E3C8C5401E977E6500067BF1 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | E3C8C51E1E977E6500067BF1 = { 74 | isa = PBXGroup; 75 | children = ( 76 | E3C8C5291E977E6500067BF1 /* NNDeviceInformation */, 77 | E3C8C5461E977E6500067BF1 /* NNDeviceInformationTests */, 78 | E3C8C5281E977E6500067BF1 /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | E3C8C5281E977E6500067BF1 /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | E3C8C5271E977E6500067BF1 /* NNDeviceInformation.app */, 86 | E3C8C5431E977E6500067BF1 /* NNDeviceInformationTests.xctest */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | E3C8C5291E977E6500067BF1 /* NNDeviceInformation */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | E3C8C5551E977EB700067BF1 /* NNDeviceInformation */, 95 | E3C8C52D1E977E6500067BF1 /* AppDelegate.h */, 96 | E3C8C52E1E977E6500067BF1 /* AppDelegate.m */, 97 | E3C8C5301E977E6500067BF1 /* NNViewController.h */, 98 | E3C8C5311E977E6500067BF1 /* NNViewController.m */, 99 | E3C8C5591E9783A300067BF1 /* NNTableViewCell.h */, 100 | E3C8C55A1E9783A300067BF1 /* NNTableViewCell.m */, 101 | E3C8C55B1E9783A300067BF1 /* NNTableViewCell.xib */, 102 | E3C8C5331E977E6500067BF1 /* Main.storyboard */, 103 | E3C8C5391E977E6500067BF1 /* Assets.xcassets */, 104 | E3C8C53B1E977E6500067BF1 /* LaunchScreen.storyboard */, 105 | E3C8C53E1E977E6500067BF1 /* Info.plist */, 106 | E3C8C5361E977E6500067BF1 /* NNDeviceInformation.xcdatamodeld */, 107 | E3C8C52A1E977E6500067BF1 /* Supporting Files */, 108 | ); 109 | path = NNDeviceInformation; 110 | sourceTree = ""; 111 | }; 112 | E3C8C52A1E977E6500067BF1 /* Supporting Files */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | E3C8C52B1E977E6500067BF1 /* main.m */, 116 | ); 117 | name = "Supporting Files"; 118 | sourceTree = ""; 119 | }; 120 | E3C8C5461E977E6500067BF1 /* NNDeviceInformationTests */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | E3C8C5471E977E6500067BF1 /* NNDeviceInformationTests.m */, 124 | E3C8C5491E977E6500067BF1 /* Info.plist */, 125 | ); 126 | path = NNDeviceInformationTests; 127 | sourceTree = ""; 128 | }; 129 | E3C8C5551E977EB700067BF1 /* NNDeviceInformation */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | E3C8C5561E977EB700067BF1 /* NNDeviceInformation.h */, 133 | E3C8C5571E977EB700067BF1 /* NNDeviceInformation.m */, 134 | ); 135 | path = NNDeviceInformation; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | E3C8C5261E977E6500067BF1 /* NNDeviceInformation */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = E3C8C54C1E977E6500067BF1 /* Build configuration list for PBXNativeTarget "NNDeviceInformation" */; 144 | buildPhases = ( 145 | E3C8C5231E977E6500067BF1 /* Sources */, 146 | E3C8C5241E977E6500067BF1 /* Frameworks */, 147 | E3C8C5251E977E6500067BF1 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | ); 153 | name = NNDeviceInformation; 154 | productName = NNDeviceInformation; 155 | productReference = E3C8C5271E977E6500067BF1 /* NNDeviceInformation.app */; 156 | productType = "com.apple.product-type.application"; 157 | }; 158 | E3C8C5421E977E6500067BF1 /* NNDeviceInformationTests */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = E3C8C54F1E977E6500067BF1 /* Build configuration list for PBXNativeTarget "NNDeviceInformationTests" */; 161 | buildPhases = ( 162 | E3C8C53F1E977E6500067BF1 /* Sources */, 163 | E3C8C5401E977E6500067BF1 /* Frameworks */, 164 | E3C8C5411E977E6500067BF1 /* Resources */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | E3C8C5451E977E6500067BF1 /* PBXTargetDependency */, 170 | ); 171 | name = NNDeviceInformationTests; 172 | productName = NNDeviceInformationTests; 173 | productReference = E3C8C5431E977E6500067BF1 /* NNDeviceInformationTests.xctest */; 174 | productType = "com.apple.product-type.bundle.unit-test"; 175 | }; 176 | /* End PBXNativeTarget section */ 177 | 178 | /* Begin PBXProject section */ 179 | E3C8C51F1E977E6500067BF1 /* Project object */ = { 180 | isa = PBXProject; 181 | attributes = { 182 | LastUpgradeCheck = 0820; 183 | ORGANIZATIONNAME = "刘朋坤"; 184 | TargetAttributes = { 185 | E3C8C5261E977E6500067BF1 = { 186 | CreatedOnToolsVersion = 8.2.1; 187 | DevelopmentTeam = 72448A77WQ; 188 | ProvisioningStyle = Automatic; 189 | }; 190 | E3C8C5421E977E6500067BF1 = { 191 | CreatedOnToolsVersion = 8.2.1; 192 | DevelopmentTeam = 72448A77WQ; 193 | ProvisioningStyle = Automatic; 194 | TestTargetID = E3C8C5261E977E6500067BF1; 195 | }; 196 | }; 197 | }; 198 | buildConfigurationList = E3C8C5221E977E6500067BF1 /* Build configuration list for PBXProject "NNDeviceInformation" */; 199 | compatibilityVersion = "Xcode 3.2"; 200 | developmentRegion = English; 201 | hasScannedForEncodings = 0; 202 | knownRegions = ( 203 | en, 204 | Base, 205 | ); 206 | mainGroup = E3C8C51E1E977E6500067BF1; 207 | productRefGroup = E3C8C5281E977E6500067BF1 /* Products */; 208 | projectDirPath = ""; 209 | projectRoot = ""; 210 | targets = ( 211 | E3C8C5261E977E6500067BF1 /* NNDeviceInformation */, 212 | E3C8C5421E977E6500067BF1 /* NNDeviceInformationTests */, 213 | ); 214 | }; 215 | /* End PBXProject section */ 216 | 217 | /* Begin PBXResourcesBuildPhase section */ 218 | E3C8C5251E977E6500067BF1 /* Resources */ = { 219 | isa = PBXResourcesBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | E3C8C53D1E977E6500067BF1 /* LaunchScreen.storyboard in Resources */, 223 | E3C8C53A1E977E6500067BF1 /* Assets.xcassets in Resources */, 224 | E3C8C5351E977E6500067BF1 /* Main.storyboard in Resources */, 225 | E3C8C55D1E9783A300067BF1 /* NNTableViewCell.xib in Resources */, 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | E3C8C5411E977E6500067BF1 /* Resources */ = { 230 | isa = PBXResourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXResourcesBuildPhase section */ 237 | 238 | /* Begin PBXSourcesBuildPhase section */ 239 | E3C8C5231E977E6500067BF1 /* Sources */ = { 240 | isa = PBXSourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | E3C8C5381E977E6500067BF1 /* NNDeviceInformation.xcdatamodeld in Sources */, 244 | E3C8C5581E977EB700067BF1 /* NNDeviceInformation.m in Sources */, 245 | E3C8C5321E977E6500067BF1 /* NNViewController.m in Sources */, 246 | E3C8C55C1E9783A300067BF1 /* NNTableViewCell.m in Sources */, 247 | E3C8C52F1E977E6500067BF1 /* AppDelegate.m in Sources */, 248 | E3C8C52C1E977E6500067BF1 /* main.m in Sources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | E3C8C53F1E977E6500067BF1 /* Sources */ = { 253 | isa = PBXSourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | E3C8C5481E977E6500067BF1 /* NNDeviceInformationTests.m in Sources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | /* End PBXSourcesBuildPhase section */ 261 | 262 | /* Begin PBXTargetDependency section */ 263 | E3C8C5451E977E6500067BF1 /* PBXTargetDependency */ = { 264 | isa = PBXTargetDependency; 265 | target = E3C8C5261E977E6500067BF1 /* NNDeviceInformation */; 266 | targetProxy = E3C8C5441E977E6500067BF1 /* PBXContainerItemProxy */; 267 | }; 268 | /* End PBXTargetDependency section */ 269 | 270 | /* Begin PBXVariantGroup section */ 271 | E3C8C5331E977E6500067BF1 /* Main.storyboard */ = { 272 | isa = PBXVariantGroup; 273 | children = ( 274 | E3C8C5341E977E6500067BF1 /* Base */, 275 | ); 276 | name = Main.storyboard; 277 | sourceTree = ""; 278 | }; 279 | E3C8C53B1E977E6500067BF1 /* LaunchScreen.storyboard */ = { 280 | isa = PBXVariantGroup; 281 | children = ( 282 | E3C8C53C1E977E6500067BF1 /* Base */, 283 | ); 284 | name = LaunchScreen.storyboard; 285 | sourceTree = ""; 286 | }; 287 | /* End PBXVariantGroup section */ 288 | 289 | /* Begin XCBuildConfiguration section */ 290 | E3C8C54A1E977E6500067BF1 /* Debug */ = { 291 | isa = XCBuildConfiguration; 292 | buildSettings = { 293 | ALWAYS_SEARCH_USER_PATHS = NO; 294 | CLANG_ANALYZER_NONNULL = YES; 295 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 296 | CLANG_CXX_LIBRARY = "libc++"; 297 | CLANG_ENABLE_MODULES = YES; 298 | CLANG_ENABLE_OBJC_ARC = YES; 299 | CLANG_WARN_BOOL_CONVERSION = YES; 300 | CLANG_WARN_CONSTANT_CONVERSION = YES; 301 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 302 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 303 | CLANG_WARN_EMPTY_BODY = YES; 304 | CLANG_WARN_ENUM_CONVERSION = YES; 305 | CLANG_WARN_INFINITE_RECURSION = YES; 306 | CLANG_WARN_INT_CONVERSION = YES; 307 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 308 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 309 | CLANG_WARN_UNREACHABLE_CODE = YES; 310 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 311 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 312 | COPY_PHASE_STRIP = NO; 313 | DEBUG_INFORMATION_FORMAT = dwarf; 314 | ENABLE_STRICT_OBJC_MSGSEND = YES; 315 | ENABLE_TESTABILITY = YES; 316 | GCC_C_LANGUAGE_STANDARD = gnu99; 317 | GCC_DYNAMIC_NO_PIC = NO; 318 | GCC_NO_COMMON_BLOCKS = YES; 319 | GCC_OPTIMIZATION_LEVEL = 0; 320 | GCC_PREPROCESSOR_DEFINITIONS = ( 321 | "DEBUG=1", 322 | "$(inherited)", 323 | ); 324 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 326 | GCC_WARN_UNDECLARED_SELECTOR = YES; 327 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 328 | GCC_WARN_UNUSED_FUNCTION = YES; 329 | GCC_WARN_UNUSED_VARIABLE = YES; 330 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 331 | MTL_ENABLE_DEBUG_INFO = YES; 332 | ONLY_ACTIVE_ARCH = YES; 333 | SDKROOT = iphoneos; 334 | TARGETED_DEVICE_FAMILY = "1,2"; 335 | }; 336 | name = Debug; 337 | }; 338 | E3C8C54B1E977E6500067BF1 /* Release */ = { 339 | isa = XCBuildConfiguration; 340 | buildSettings = { 341 | ALWAYS_SEARCH_USER_PATHS = NO; 342 | CLANG_ANALYZER_NONNULL = YES; 343 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 344 | CLANG_CXX_LIBRARY = "libc++"; 345 | CLANG_ENABLE_MODULES = YES; 346 | CLANG_ENABLE_OBJC_ARC = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_CONSTANT_CONVERSION = YES; 349 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 350 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 362 | ENABLE_NS_ASSERTIONS = NO; 363 | ENABLE_STRICT_OBJC_MSGSEND = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_NO_COMMON_BLOCKS = YES; 366 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 367 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 368 | GCC_WARN_UNDECLARED_SELECTOR = YES; 369 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 370 | GCC_WARN_UNUSED_FUNCTION = YES; 371 | GCC_WARN_UNUSED_VARIABLE = YES; 372 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 373 | MTL_ENABLE_DEBUG_INFO = NO; 374 | SDKROOT = iphoneos; 375 | TARGETED_DEVICE_FAMILY = "1,2"; 376 | VALIDATE_PRODUCT = YES; 377 | }; 378 | name = Release; 379 | }; 380 | E3C8C54D1E977E6500067BF1 /* Debug */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 384 | DEVELOPMENT_TEAM = 72448A77WQ; 385 | INFOPLIST_FILE = NNDeviceInformation/Info.plist; 386 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 387 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 388 | PRODUCT_BUNDLE_IDENTIFIER = KangXin.NNDeviceInformation; 389 | PRODUCT_NAME = "$(TARGET_NAME)"; 390 | }; 391 | name = Debug; 392 | }; 393 | E3C8C54E1E977E6500067BF1 /* Release */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 397 | DEVELOPMENT_TEAM = 72448A77WQ; 398 | INFOPLIST_FILE = NNDeviceInformation/Info.plist; 399 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 400 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 401 | PRODUCT_BUNDLE_IDENTIFIER = KangXin.NNDeviceInformation; 402 | PRODUCT_NAME = "$(TARGET_NAME)"; 403 | }; 404 | name = Release; 405 | }; 406 | E3C8C5501E977E6500067BF1 /* Debug */ = { 407 | isa = XCBuildConfiguration; 408 | buildSettings = { 409 | BUNDLE_LOADER = "$(TEST_HOST)"; 410 | DEVELOPMENT_TEAM = 72448A77WQ; 411 | INFOPLIST_FILE = NNDeviceInformationTests/Info.plist; 412 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 413 | PRODUCT_BUNDLE_IDENTIFIER = KangXin.NNDeviceInformationTests; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NNDeviceInformation.app/NNDeviceInformation"; 416 | }; 417 | name = Debug; 418 | }; 419 | E3C8C5511E977E6500067BF1 /* Release */ = { 420 | isa = XCBuildConfiguration; 421 | buildSettings = { 422 | BUNDLE_LOADER = "$(TEST_HOST)"; 423 | DEVELOPMENT_TEAM = 72448A77WQ; 424 | INFOPLIST_FILE = NNDeviceInformationTests/Info.plist; 425 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 426 | PRODUCT_BUNDLE_IDENTIFIER = KangXin.NNDeviceInformationTests; 427 | PRODUCT_NAME = "$(TARGET_NAME)"; 428 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NNDeviceInformation.app/NNDeviceInformation"; 429 | }; 430 | name = Release; 431 | }; 432 | /* End XCBuildConfiguration section */ 433 | 434 | /* Begin XCConfigurationList section */ 435 | E3C8C5221E977E6500067BF1 /* Build configuration list for PBXProject "NNDeviceInformation" */ = { 436 | isa = XCConfigurationList; 437 | buildConfigurations = ( 438 | E3C8C54A1E977E6500067BF1 /* Debug */, 439 | E3C8C54B1E977E6500067BF1 /* Release */, 440 | ); 441 | defaultConfigurationIsVisible = 0; 442 | defaultConfigurationName = Release; 443 | }; 444 | E3C8C54C1E977E6500067BF1 /* Build configuration list for PBXNativeTarget "NNDeviceInformation" */ = { 445 | isa = XCConfigurationList; 446 | buildConfigurations = ( 447 | E3C8C54D1E977E6500067BF1 /* Debug */, 448 | E3C8C54E1E977E6500067BF1 /* Release */, 449 | ); 450 | defaultConfigurationIsVisible = 0; 451 | }; 452 | E3C8C54F1E977E6500067BF1 /* Build configuration list for PBXNativeTarget "NNDeviceInformationTests" */ = { 453 | isa = XCConfigurationList; 454 | buildConfigurations = ( 455 | E3C8C5501E977E6500067BF1 /* Debug */, 456 | E3C8C5511E977E6500067BF1 /* Release */, 457 | ); 458 | defaultConfigurationIsVisible = 0; 459 | }; 460 | /* End XCConfigurationList section */ 461 | 462 | /* Begin XCVersionGroup section */ 463 | E3C8C5361E977E6500067BF1 /* NNDeviceInformation.xcdatamodeld */ = { 464 | isa = XCVersionGroup; 465 | children = ( 466 | E3C8C5371E977E6500067BF1 /* NNDeviceInformation.xcdatamodel */, 467 | ); 468 | currentVersion = E3C8C5371E977E6500067BF1 /* NNDeviceInformation.xcdatamodel */; 469 | path = NNDeviceInformation.xcdatamodeld; 470 | sourceTree = ""; 471 | versionGroupType = wrapper.xcdatamodel; 472 | }; 473 | /* End XCVersionGroup section */ 474 | }; 475 | rootObject = E3C8C51F1E977E6500067BF1 /* Project object */; 476 | } 477 | --------------------------------------------------------------------------------