├── ALSystemUtilities ├── en.lproj │ └── InfoPlist.strings ├── ALSystemUtilities │ ├── ALSystemConstants │ │ ├── ALSystem_JailbreakConstants.h │ │ ├── ALSystem_AccessoryConstants.h │ │ ├── ALSystem_MemoryConstants.h │ │ ├── ALSystem_CarrierConstants.h │ │ ├── ALSystem_ProcessorConstants.h │ │ ├── ALSystem_LocalizationConstants.h │ │ ├── ALSystem_DiskConstants.h │ │ ├── ALSystemConstants.h │ │ ├── ALSystem_NetworkConstants.h │ │ ├── ALSystem_ALBatteryConstants.h │ │ └── ALSystem_HardwareConstants.h │ ├── ALJailbreak │ │ ├── ALJailbreak.h │ │ └── ALJailbreak.m │ ├── 3RPartyHelper.h │ ├── ALAccessory │ │ ├── ALAccessory.m │ │ └── ALAccessory.h │ ├── Resources │ │ ├── iPodTouch │ │ │ ├── iPodTouch3.plist │ │ │ ├── iPodTouch4.plist │ │ │ └── iPodTouch5.plist │ │ └── iPhone │ │ │ ├── iPhone4.plist │ │ │ ├── iPhone4s.plist │ │ │ ├── iPhone3Gs.plist │ │ │ ├── iPhone5.plist │ │ │ ├── iPhone5c.plist │ │ │ └── iPhone5s.plist │ ├── ALLocalization │ │ ├── ALLocalization.m │ │ └── ALLocalization.h │ ├── ALDisk │ │ ├── ALDisk.h │ │ └── ALDisk.m │ ├── ALCarrier │ │ ├── ALCarrier.h │ │ └── ALCarrier.m │ ├── ALProcessor │ │ ├── ALProcessor.h │ │ └── ALProcessor.m │ ├── ALMemory │ │ ├── ALMemory.h │ │ └── ALMemory.m │ ├── ALNetwork │ │ ├── ALNetwork.h │ │ └── ALNetwork.m │ ├── ALBattery │ │ ├── ALBattery.h │ │ └── ALBattery.m │ ├── ALSystem │ │ ├── ALSystem.h │ │ └── ALSystem.m │ ├── ALHardware │ │ ├── ALHardware.h │ │ └── ALHardware.m │ └── Reachability │ │ ├── Reachability.h │ │ └── Reachability.m ├── ALSystemUtilities-Prefix.pch └── ALSystemUtilities-Info.plist ├── ALSystemUtilities.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ ├── AL08.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ ├── mac.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ └── lihongli.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ └── ALSystemUtilities.xccheckout ├── xcuserdata │ ├── lihongli.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ ├── AL08.xcuserdatad │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── ALSystemUtilities.xcscheme │ └── mac.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── xcshareddata │ └── xcschemes │ │ └── ALSystemUtilities.xcscheme └── project.pbxproj └── README.md /ALSystemUtilities/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/project.xcworkspace/xcuserdata/AL08.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iodefog/ALSystemUtilities-develop-1/HEAD/ALSystemUtilities.xcodeproj/project.xcworkspace/xcuserdata/AL08.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iodefog/ALSystemUtilities-develop-1/HEAD/ALSystemUtilities.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/project.xcworkspace/xcuserdata/lihongli.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iodefog/ALSystemUtilities-develop-1/HEAD/ALSystemUtilities.xcodeproj/project.xcworkspace/xcuserdata/lihongli.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_JailbreakConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_JailbreakConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 10/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALJailbreak_isJailbroken = @"isJailbroken"; -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #import 11 | #import 12 | #endif 13 | -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/xcuserdata/lihongli.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SuppressBuildableAutocreation 6 | 7 | 87D8E4A3182156D300546E6D 8 | 9 | primary 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_AccessoryConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_AccessoryConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 10/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALAccessory_accessoriesPluggedIn = @"accessoriesPluggedIn"; 10 | static NSString *const ALAccessory_numberOfAccessoriesPluggedIn = @"numberOfAccessoriesPluggedIn"; 11 | static NSString *const ALAccessory_isHeadphonesAttached = @"isHeadphonesAttached"; -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/xcuserdata/AL08.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ALSystemUtilities.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 87D8E4A3182156D300546E6D 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_MemoryConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_MemoryConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 10/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALMemory_totalMemory = @"totalMemory"; 10 | static NSString *const ALMemory_freeMemory = @"freeMemory"; 11 | static NSString *const ALMemory_usedMemory = @"usedMemory"; 12 | static NSString *const ALMemory_activeMemory = @"activeMemory"; 13 | static NSString *const ALMemory_wiredMemory = @"wiredMemory"; 14 | static NSString *const ALMemory_inactivemMemory = @"inactiveMemory"; -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALJailbreak/ALJailbreak.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALJailbreak.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #include 11 | #include 12 | 13 | /*! 14 | * This class detects if the device is jailbroken. The class check the presence or less of the Cydia.app 15 | */ 16 | @interface ALJailbreak : NSObject 17 | 18 | /*! 检查硬件是否越狱 19 | Check if the device is jailbroken 20 | @return YES if the device is jailbroken, NO if it isn't 21 | */ 22 | + (BOOL)isJailbroken; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ALSystemUtilities.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 87D8E4A3182156D300546E6D 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_CarrierConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_CarrierConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 10/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALCarrier_carrierName = @"carrierName"; 10 | static NSString *const ALCarrier_carrierISOCountryCode = @"carrierISOCountryCode"; 11 | static NSString *const ALCarrier_carrierMobileCountryCode = @"carrierMobileCountryCode"; 12 | static NSString *const ALCarrier_carriermobileNetworkCode = @"carrierMobileNetworkCode"; 13 | static NSString *const ALCarrier_carrierAllowsVOIP = @"carrierAllowsVOIP"; -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_ProcessorConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_ProcessorConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 10/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALProcessor_processorsNumber = @"processorsNumber"; 10 | static NSString *const ALProcessor_activeProcessorsNumber = @"activeProcessorsNumber"; 11 | static NSString *const ALProcessor_cpuUsageForApp = @"cpuUsageForApp"; 12 | static NSString *const ALProcessor_activeProcesses = @"activeProcesses"; 13 | static NSString *const ALProcessor_numberOfActiveProcesses = @"numberOfActiveProcesses"; -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/3RPartyHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // 3RPartyHelper.h 3 | // ALSystemUtilities 4 | // 5 | // Created by King on 13-11-18. 6 | // Copyright (c) 2013年 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #ifndef ALSystemUtilities__RPartyHelper_h 10 | #define ALSystemUtilities__RPartyHelper_h 11 | 12 | #import "ALSystemConstants.h" 13 | #import "ALProcessor.h" 14 | #import "ALNetwork.h" 15 | #import "ALMemory.h" 16 | #import "ALLocalization.h" 17 | #import "ALJailbreak.h" 18 | #import "ALHardware.h" 19 | #import "ALDisk.h" 20 | #import "ALCarrier.h" 21 | #import "ALBattery.h" 22 | #import "ALAccessory.h" 23 | #import "ALSystem.h" 24 | #import "Reachability.h" 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_LocalizationConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_LocalizationConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 10/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALLocalization_language = @"language"; 10 | static NSString *const ALLocalization_timeZone = @"timeZone"; 11 | static NSString *const ALLocalization_currencySimbol = @"currencySimbol"; 12 | static NSString *const ALLocalization_currencyCode = @"currencyCode"; 13 | static NSString *const ALLocalization_country = @"country"; 14 | static NSString *const ALLocalization_measurementSystem = @"measurementSystem"; -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_DiskConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_DiskConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 09/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALDisk_totalDiskSpace = @"totalDiskSpace"; 10 | static NSString *const ALDisk_freeDiskSpace = @"freeDiskSpace"; 11 | static NSString *const ALDisk_usedDiskSpace = @"usedDiskSpace"; 12 | static NSString *const ALDisk_totalDiskSpaceInBytes = @"totalDiskSpaceInBytes"; 13 | static NSString *const ALDisk_freeDiskSpaceInBytes = @"freeDiskSpaceInBytes"; 14 | static NSString *const ALDisk_usedDiskSpaceInBytes = @"usedDiskSpaceInBytes"; -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystemConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystemConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 10/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #ifndef ALSystem_ALSystemConstants_h 10 | #define ALSystem_ALSystemConstants_h 11 | 12 | #import "ALSystem_ALBatteryConstants.h" 13 | #import "ALSystem_AccessoryConstants.h" 14 | #import "ALSystem_CarrierConstants.h" 15 | #import "ALSystem_DiskConstants.h" 16 | #import "ALSystem_HardwareConstants.h" 17 | #import "ALSystem_JailbreakConstants.h" 18 | #import "ALSystem_LocalizationConstants.h" 19 | #import "ALSystem_MemoryConstants.h" 20 | #import "ALSystem_NetworkConstants.h" 21 | #import "ALSystem_ProcessorConstants.h" 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALAccessory/ALAccessory.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALAccessory.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 22/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALAccessory.h" 10 | 11 | @implementation ALAccessory 12 | 13 | + (BOOL)accessoriesPluggedIn { 14 | int accessoryCount = [[[EAAccessoryManager sharedAccessoryManager] connectedAccessories] count]; 15 | if (accessoryCount > 0) 16 | return YES; 17 | else 18 | return NO; 19 | } 20 | 21 | + (NSInteger)numberOfAccessoriesPluggedIn { 22 | return [[[EAAccessoryManager sharedAccessoryManager] connectedAccessories] count]; 23 | } 24 | 25 | // TODO: Da sviluppare ASSOLUTAMENTE 26 | + (BOOL)isHeadphonesAttached { 27 | return NO; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_NetworkConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_NetworkConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 10/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALNetwork_currentIPAddress = @"currentIPAddress"; 10 | static NSString *const ALNetwork_connectedViaWiFi = @"connectedViaWiFi"; 11 | static NSString *const ALNetwork_connectedVia3G = @"connectedVia3G"; 12 | static NSString *const ALNetwork_macAddress = @"macAddress"; 13 | static NSString *const ALNetwork_externalIPAddress = @"externalIPAddress"; 14 | static NSString *const ALNetwork_cellIPAddress = @"cellIPAddress"; 15 | static NSString *const ALNetwork_WiFiNetmaskAddress = @"WiFiNetmaskAddress"; 16 | static NSString *const ALNetwork_WiFiBroadcastAddress = @"WiFiBroadcastAddress"; -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALJailbreak/ALJailbreak.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALJailbreak.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALJailbreak.h" 10 | 11 | @implementation ALJailbreak 12 | 13 | + (BOOL)isJailbroken { 14 | // NSString *filePath = @"/Applications/Cydia.app"; 15 | // if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) 16 | // return YES; 17 | // else 18 | // return NO; 19 | FILE *f = fopen("/bin/bash", "r"); 20 | BOOL isJailbroken = NO; 21 | if (f != NULL) 22 | // Device is jailbroken 23 | isJailbroken = YES; 24 | else 25 | // Device isn't jailbroken 26 | isJailbroken = NO; 27 | 28 | fclose(f); 29 | 30 | return isJailbroken; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPodTouch/iPodTouch3.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | audio 6 | 30 7 | video 8 | 6 9 | dimensions 10 | 110 x 61,8 x 8,5 (mm) 11 | weight 12 | 115 g. 13 | display-type 14 | TFT capacitive touchscreen 15 | display-density 16 | 330 ppi 17 | WLAN 18 | WiFi 802.11 b/g 19 | bluetooth 20 | 2.1 21 | camera-primary 22 | No 23 | camera-secondary 24 | No 25 | cpu 26 | 833 MHz Cortex-A8 (locked at 600) 27 | gpu 28 | PowerVR SGX 535 29 | 30 | 31 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPodTouch/iPodTouch4.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | audio 6 | 40 7 | video 8 | 7 9 | dimensions 10 | 110 x 58,9 x 7,1 (mm) 11 | weight 12 | 101 g. 13 | display-type 14 | LED-backlit IPS LCD, capacitive touchscreen 15 | display-density 16 | 326 ppi 17 | WLAN 18 | Wi-Fi 802.11 b/g/n 19 | bluetooth 20 | 2.1 21 | camera-primary 22 | HD 720p 23 | camera-secondary 24 | VGA 25 | cpu 26 | Apple A4 800 MHz 27 | gpu 28 | PowerVR SGX 29 | 30 | 31 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPodTouch/iPodTouch5.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | audio 6 | 40 7 | video 8 | 8 9 | dimensions 10 | 123,4 x 58,6 x 6,1 (mm) 11 | weight 12 | 88 g. 13 | display-type 14 | LED-backlit IPS LCD, capacitive touchscreen 15 | display-density 16 | 326 ppi 17 | WLAN 18 | Wi-Fi 802.11 a/b/g/n, dual-band 19 | bluetooth 20 | 4.0 21 | camera-primary 22 | 5.0 MP 23 | camera-secondary 24 | 1.2 MP 25 | cpu 26 | Apple A5 27 | gpu 28 | 625 29 | 30 | 31 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.andrealufino.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALLocalization/ALLocalization.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALLocalization.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALLocalization.h" 10 | 11 | @implementation ALLocalization 12 | 13 | + (NSString *)language { 14 | return [[NSLocale preferredLanguages] objectAtIndex:0]; 15 | } 16 | 17 | + (NSString *)timeZone { 18 | return [[NSTimeZone systemTimeZone] name]; 19 | } 20 | 21 | + (NSString *)currencySymbol { 22 | return [[NSLocale currentLocale] objectForKey:NSLocaleCurrencySymbol]; 23 | } 24 | 25 | + (NSString *)currencyCode { 26 | return [[NSLocale currentLocale] objectForKey:NSLocaleCurrencyCode]; 27 | } 28 | 29 | + (NSString *)country { 30 | return [[NSLocale currentLocale] localeIdentifier]; 31 | } 32 | 33 | + (NSString *)measurementSystem { 34 | return [[NSLocale currentLocale] objectForKey:NSLocaleMeasurementSystem]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALAccessory/ALAccessory.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALAccessory.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 22/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | /*! 14 | * This class detect if there are accessories plugged into the device 15 | */ 16 | @interface ALAccessory : NSObject 17 | 18 | /*! 检查是否有配件插入 19 | Check if there are accessories plugged in 20 | @return YES if there are accessories plugged in, NO if there aren't 21 | */ 22 | + (BOOL)accessoriesPluggedIn; 23 | 24 | /*! 检查配件数量 25 | Check the number of accessories plugged in 26 | @return NSInteger which represents the number of accessories plugged in 27 | */ 28 | + (NSInteger)numberOfAccessoriesPluggedIn; 29 | 30 | /*! 检查是否耳机插入 31 | Check if headphones is plugged in 32 | @return YES if headphones are plugged in, NO if it aren't 33 | */ 34 | + (BOOL)isHeadphonesAttached; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_ALBatteryConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_ALBatteryConst.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 09/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALBattery_batteryFullCharged = @"batteryFullCharged"; 10 | static NSString *const ALBattery_inCharge = @"inCharge"; 11 | static NSString *const ALBattery_devicePluggedIntoPower = @"devicePluggedIntoPower"; 12 | static NSString *const ALBattery_batteryState = @"batteryState"; 13 | static NSString *const ALBattery_batteryLevel = @"batteryLevel"; 14 | static NSString *const ALBattery_remainingHoursForStandby = @"remainingHoursForStandby"; 15 | static NSString *const ALBattery_remainingHoursFor3gConversation = @"remainingHoursFor3gConversation"; 16 | static NSString *const ALBattery_remainingHoursFor2gConversation = @"remainingHoursFor2gConversation"; 17 | static NSString *const ALBattery_remainingHoursForInternet3g = @"remainingHoursForInternet3g"; 18 | static NSString *const ALBattery_remainingHoursForInternetWiFi = @"remainingHoursForInternetWiFi"; 19 | static NSString *const ALBattery_remainingHoursForVideo = @"remainingHoursForVideo"; 20 | static NSString *const ALBattery_remainingHoursForAudio = @"remainingHoursForAudio"; -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALDisk/ALDisk.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALDisk.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 19/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /*! 12 | * Check total and free disk space 13 | */ 14 | @interface ALDisk : NSObject 15 | 16 | /*! 总的磁盘空间 17 | The total disk space 18 | @return String which represents the total disk space 19 | */ 20 | + (NSString *)totalDiskSpace; 21 | 22 | /*! 剩余磁盘空间 23 | The free disk space 24 | @return String which represents the free disk space 25 | */ 26 | + (NSString *)freeDiskSpace; 27 | 28 | /*! 已经使用的磁盘空间 29 | The used disk space 30 | @return String which represents the used disk space 31 | */ 32 | + (NSString *)usedDiskSpace; 33 | 34 | /*! 总的磁盘空间的字节数 35 | The total disk space in bytes 36 | @return CGFloat represents the total disk space in bytes 37 | */ 38 | + (CGFloat)totalDiskSpaceInBytes; 39 | 40 | /*! 剩余磁盘空间的字节数 41 | The free disk space in bytes 42 | @return CGFloat represents the free disk space in bytes 43 | */ 44 | + (CGFloat)freeDiskSpaceInBytes; 45 | 46 | /*! 已经使用的磁盘空间的字节数 47 | The used disk space in bytes 48 | @return CGFloat represents the used disk space in bytes 49 | */ 50 | + (CGFloat)usedDiskSpaceInBytes; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALLocalization/ALLocalization.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALLocalization.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /*! 12 | * This class provides some informations about the localization of the device 13 | */ 14 | @interface ALLocalization : NSObject 15 | 16 | /*! 获取 系统语言 17 | The language of the system 18 | @return NSString representing the language 19 | */ 20 | + (NSString *)language; 21 | 22 | /*! 获取当前时区 23 | The current time zone 24 | @return NSString representing the time zone 25 | */ 26 | + (NSString *)timeZone; 27 | 28 | /*! 系统的货币符号 29 | The currency symbol of the system 30 | @return NSString representing the current currency symbol 31 | */ 32 | + (NSString *)currencySymbol; 33 | 34 | /*! 获取货币代码的系统 35 | The currency code of the system 36 | @return NSString representing the currency code 37 | */ 38 | + (NSString *)currencyCode; 39 | 40 | /*! 获取 国家名字 41 | The country 42 | @return NSString representing the country of the system 43 | */ 44 | + (NSString *)country; 45 | 46 | /*! 获取测量系统 47 | The measurement system 48 | @return NSString representing the measurement system 49 | */ 50 | + (NSString *)measurementSystem; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALCarrier/ALCarrier.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALCarrier.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | /*! 14 | * This class provides method to get info about the carrier 15 | */ 16 | @interface ALCarrier : NSObject 17 | 18 | /*! 载体名 19 | The carrier name 20 | @return NSString represents the carrier name 21 | */ 22 | + (NSString *)carrierName; 23 | 24 | /*! 代表载体的ISO国家编号 25 | The ISO country code of the carrier 26 | @return NSString represents the ISO country code of the carrier 27 | */ 28 | + (NSString *)carrierISOCountryCode; 29 | 30 | /*!代表载体手机国家编号 31 | The carrier mobile country code 32 | @return NSString represents the mobile country code of the carrier 33 | */ 34 | + (NSString *)carrierMobileCountryCode; 35 | 36 | /*! 代表了手机网络编号 37 | The carrier mobile network code 38 | @return NSString represents the mobile network code 39 | */ 40 | + (NSString *)carrierMobileNetworkCode; 41 | 42 | /*! 检查载体是否允许VOIP 43 | Check if the carrier allows VOIP 44 | @return YES if the carrier allows VOIP, NO if it isn't 45 | */ 46 | + (BOOL)carrierAllowsVOIP; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALProcessor/ALProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALProcessor.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | /*! 14 | * This class provide informations about processors 15 | */ 16 | @interface ALProcessor : NSObject 17 | 18 | /*! 获取处理器的总数量 19 | Check the number of processors 20 | @return NSInteger which represents the number of processors 21 | */ 22 | + (NSInteger)processorsNumber; 23 | 24 | /*! 获取获取活跃处理器的数量 25 | Check the number of active processors 26 | @return NSInteger which represents the number of active processors 27 | */ 28 | + (NSInteger)activeProcessorsNumber; 29 | 30 | /*! 获取app使用cpu 的大小 31 | The cpu usage for the app in use 32 | @return Float value represents the cpu usage for the app in use 33 | */ 34 | + (CGFloat)cpuUsageForApp; 35 | 36 | /*! 获取活跃的处理器数组 37 | The active processes list 38 | @return NSArray containing the list of active processes 39 | */ 40 | + (NSArray *)activeProcesses; 41 | 42 | /*! 获取活跃处理器个数 43 | The number of active processes 44 | @return NSInteger value represents the number of active processes 45 | */ 46 | + (NSInteger)numberOfActiveProcesses; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALMemory/ALMemory.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALMemory.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | /*! 14 | * This class provides some informations about the memory of the device 15 | */ 16 | @interface ALMemory : NSObject 17 | 18 | /*! 获取硬件的总的内存信息大小 19 | Check the total memory of the device 20 | @return NSInteger value which represents the total memory 21 | */ 22 | + (NSInteger)totalMemory; 23 | 24 | /*! 获取硬件的剩余内存大小 25 | Check free memory 26 | @return CGFloat which represents the free memory 27 | */ 28 | + (CGFloat)freeMemory; 29 | 30 | /*! 获取硬件已经使用的内存大小 31 | Check the used memory 32 | @return CGFloat which represents the used memory 33 | */ 34 | + (CGFloat)usedMemory; 35 | 36 | /*! 获取活跃的内存大小 37 | Check the active memory 38 | @return CGFloat which represents the active memory of the device 39 | */ 40 | + (CGFloat)activeMemory; 41 | 42 | /*! 获取有线内存大小 43 | Check wired memory 44 | @return CGFloat which represents the wired memory 45 | */ 46 | + (CGFloat)wiredMemory; 47 | 48 | /*! 获取未活跃的内存大小 49 | Check the inactive memory 50 | @return CGFloat which represents the inactive memory 51 | */ 52 | + (CGFloat)inactiveMemory; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPhone/iPhone4.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | standby 6 | 300 7 | conversation3g 8 | 7 9 | conversation2g 10 | 14 11 | internet3g 12 | 6 13 | internetwifi 14 | 10 15 | video 16 | 10 17 | audio 18 | 40 19 | sim 20 | Micro-SIM 21 | dimensions 22 | 115.2 x 58.6 x 9.3 (mm) 23 | weight 24 | 137 g. 25 | display-type 26 | LED IPS LCD 27 | display-density 28 | 330 ppi 29 | WLAN 30 | Wi-Fi 802.11 b/g/n 31 | bluetooth 32 | 2.1 33 | camera-primary 34 | 5.0 MP 35 | camera-secondary 36 | VGA 480p 37 | cpu 38 | Apple A4 a 800 MHz 39 | gpu 40 | PowerVR SGX535 41 | siri 42 | No 43 | touch-id 44 | No 45 | 46 | 47 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPhone/iPhone4s.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | standby 6 | 200 7 | conversation3g 8 | 8 9 | conversation2g 10 | 14 11 | internet3g 12 | 6 13 | internetwifi 14 | 9 15 | video 16 | 10 17 | audio 18 | 40 19 | sim 20 | Micro-SIM 21 | dimensions 22 | 115.2 x 58.6 x 9.3 (mm) 23 | weight 24 | 140 g. 25 | display-type 26 | LED IPS LCD 27 | display-density 28 | 330 ppi 29 | WLAN 30 | Wi-Fi 802.11 b/g/n 31 | bluetooth 32 | 4.0 33 | camera-primary 34 | 8.0 MP 35 | camera-secondary 36 | VGA 480p 37 | cpu 38 | Apple A5 da 800Mhz 39 | gpu 40 | PowerVR SGX543MP2 41 | siri 42 | Yes 43 | touch-id 44 | No 45 | 46 | 47 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPhone/iPhone3Gs.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | standby 6 | 300 7 | conversation3g 8 | 5 9 | conversation2g 10 | 12 11 | internet3g 12 | 5 13 | internetwifi 14 | 9 15 | video 16 | 10 17 | audio 18 | 30 19 | sim 20 | Mini-SIM 21 | dimensions 22 | 115,5 x 62,1 x 12,3 (mm) 23 | weight 24 | 135 g. 25 | display-type 26 | TFT capacitive touchscreen 27 | display-density 28 | 165 ppi 29 | WLAN 30 | WiFi 802.11 b/g 31 | bluetooth 32 | 2.1 33 | camera-primary 34 | 3.15 MP 35 | camera-secondary 36 | No 37 | cpu 38 | 600 MHz Cortex-A8 39 | gpu 40 | PowerVR SGX535 41 | siri 42 | No 43 | touch-id 44 | No 45 | 46 | 47 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPhone/iPhone5.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | standby 6 | 225 7 | conversation3g 8 | 7 9 | conversation2g 10 | 15 11 | internet3g 12 | 8 13 | internetwifi 14 | 10 15 | video 16 | 10 17 | audio 18 | 40 19 | sim 20 | Nano-SIM 21 | dimensions 22 | 123.8 x 58.6 x 7.6 (mm) 23 | weight 24 | 112 g. 25 | display-type 26 | LED IPS LCD 27 | display-density 28 | 326 ppi 29 | WLAN 30 | Wi-Fi 802.11 a/b/g/n, dual-band 31 | bluetooth 32 | 4.0 33 | camera-primary 34 | 8.0 MP 35 | camera-secondary 36 | 1.2 MP, 720p 37 | cpu 38 | Apple A6 39 | gpu 40 | PowerVR SGX 543MP3 (triple-core graphics) 41 | siri 42 | Yes 43 | touch-id 44 | No 45 | 46 | 47 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPhone/iPhone5c.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | standby 6 | 250 7 | conversation3g 8 | 10 9 | conversation2g 10 | 18 11 | internet3g 12 | 8 13 | internetwifi 14 | 10 15 | video 16 | 10 17 | audio 18 | 40 19 | sim 20 | Nano-SIM 21 | dimensions 22 | 124,4 x 59,2 x 8,97 (mm) 23 | weight 24 | 132 g. 25 | display-type 26 | LED IPS LCD 27 | display-density 28 | 326 ppi 29 | WLAN 30 | Wi-Fi 802.11 a/b/g/n, dual-band 31 | bluetooth 32 | 4.0 33 | camera-primary 34 | 8.0 MP 35 | camera-secondary 36 | 1.2 MP, 720p 37 | cpu 38 | Apple A6 39 | gpu 40 | PowerVR SGX 543MP3 (triple-core graphics) 41 | siri 42 | Yes 43 | touch-id 44 | No 45 | 46 | 47 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Resources/iPhone/iPhone5s.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | standby 6 | 250 7 | conversation3g 8 | 10 9 | conversation2g 10 | 18 11 | internet3g 12 | 8 13 | internetwifi 14 | 10 15 | video 16 | 10 17 | audio 18 | 40 19 | sim 20 | Nano-SIM 21 | dimensions 22 | 123,8 x 58,6 x 7,6 (mm) 23 | weight 24 | 112 g. 25 | display-type 26 | LED IPS LCD 27 | display-density 28 | 326 ppi 29 | WLAN 30 | Wi-Fi 802.11 a/b/g/n, dual-band 31 | bluetooth 32 | 4.0 33 | camera-primary 34 | 8.0 MP 35 | camera-secondary 36 | 1.2 MP, 720p 37 | cpu 38 | Apple A7 64 bit / M7 39 | gpu 40 | PowerVR SGX 543MP3 (triple-core graphics) 41 | siri 42 | Yes 43 | touch-id 44 | Yes 45 | 46 | 47 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALCarrier/ALCarrier.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALCarrier.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALCarrier.h" 10 | 11 | @implementation ALCarrier 12 | 13 | + (NSString *)carrierName { 14 | CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; 15 | CTCarrier *carrier = [netinfo subscriberCellularProvider]; 16 | return [carrier carrierName]; 17 | } 18 | 19 | + (NSString *)carrierISOCountryCode { 20 | CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; 21 | CTCarrier *carrier = [netinfo subscriberCellularProvider]; 22 | return [carrier isoCountryCode]; 23 | } 24 | 25 | + (NSString *)carrierMobileCountryCode { 26 | CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; 27 | CTCarrier *carrier = [netinfo subscriberCellularProvider]; 28 | return [carrier mobileCountryCode]; 29 | } 30 | 31 | + (NSString *)carrierMobileNetworkCode { 32 | CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; 33 | CTCarrier *carrier = [netinfo subscriberCellularProvider]; 34 | return [carrier mobileNetworkCode]; 35 | } 36 | 37 | + (BOOL)carrierAllowsVOIP { 38 | CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; 39 | CTCarrier *carrier = [netinfo subscriberCellularProvider]; 40 | return [carrier allowsVOIP]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystemConstants/ALSystem_HardwareConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem_HardwareConstants.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 09/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | static NSString *const ALHardware_deviceModel = @"deviceModel"; 10 | static NSString *const ALHardware_deviceName = @"deviceName"; 11 | static NSString *const ALHardware_systemName = @"systemName"; 12 | static NSString *const ALHardware_systemVersion = @"systemVersion"; 13 | static NSString *const ALHardware_screenWidth = @"screenWidth"; 14 | static NSString *const ALHardware_screenHeight = @"screenHeight"; 15 | static NSString *const ALHardware_brightness = @"brightness"; 16 | static NSString *const ALHardware_platformType = @"platformType"; 17 | static NSString *const ALHardware_bootTime = @"bootTime"; 18 | static NSString *const ALHardware_proximitySensor = @"proximitySensor"; 19 | static NSString *const ALHardware_multitaskingEnabled = @"multitaskingEnabled"; 20 | // 1.2 21 | static NSString *const ALHardware_sim = @"sim"; 22 | static NSString *const ALHardware_dimensions = @"dimensions"; 23 | static NSString *const ALHardware_weight = @"weight"; 24 | static NSString *const ALHardware_displayType = @"displayType"; 25 | static NSString *const ALHardware_displayDensity = @"displayDensity"; 26 | static NSString *const ALHardware_WLAN = @"WLAN"; 27 | static NSString *const ALHardware_bluetooth = @"bluetooth"; 28 | static NSString *const ALHardware_cameraPrimary = @"cameraPrimary"; 29 | static NSString *const ALHardware_cameraSecondary = @"cameraSecondary"; 30 | static NSString *const ALHardware_cpu = @"cpu"; 31 | static NSString *const ALHardware_gpu = @"gpu"; 32 | static NSString *const ALHardware_touchID = @"touch-id"; -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/project.xcworkspace/xcshareddata/ALSystemUtilities.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 3642489F-D277-4D8C-AAA2-1B5CB7008E73 9 | IDESourceControlProjectName 10 | ALSystemUtilities 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | B2970D57A48608E7EEFEC7D656156893BF338B2C 14 | https://github.com/lihongli528628/ALSystemUtilities-develop-1.git 15 | 16 | IDESourceControlProjectPath 17 | ALSystemUtilities.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | B2970D57A48608E7EEFEC7D656156893BF338B2C 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/lihongli528628/ALSystemUtilities-develop-1.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | B2970D57A48608E7EEFEC7D656156893BF338B2C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | B2970D57A48608E7EEFEC7D656156893BF338B2C 36 | IDESourceControlWCCName 37 | ALSystemUtilities-develop-1 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALDisk/ALDisk.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALDisk.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 19/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALDisk.h" 10 | 11 | #define MB (1024*1024) 12 | #define GB (MB*1024) 13 | 14 | @implementation ALDisk 15 | 16 | #pragma mark - Formatter 17 | 18 | + (NSString *)memoryFormatter:(long long)diskSpace { 19 | NSString *formatted; 20 | double bytes = 1.0 * diskSpace; 21 | double megabytes = bytes / MB; 22 | double gigabytes = bytes / GB; 23 | if (gigabytes >= 1.0) 24 | formatted = [NSString stringWithFormat:@"%.2f GB", gigabytes]; 25 | else if (megabytes >= 1.0) 26 | formatted = [NSString stringWithFormat:@"%.2f MB", megabytes]; 27 | else 28 | formatted = [NSString stringWithFormat:@"%.2f bytes", bytes]; 29 | 30 | return formatted; 31 | } 32 | 33 | #pragma mark - Methods 34 | 35 | + (NSString *)totalDiskSpace { 36 | long long space = [[[[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemSize] longLongValue]; 37 | return [self memoryFormatter:space]; 38 | } 39 | 40 | + (NSString *)freeDiskSpace { 41 | long long freeSpace = [[[[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemFreeSize] longLongValue]; 42 | return [self memoryFormatter:freeSpace]; 43 | } 44 | 45 | + (NSString *)usedDiskSpace { 46 | return [self memoryFormatter:[self usedDiskSpaceInBytes]]; 47 | } 48 | 49 | + (CGFloat)totalDiskSpaceInBytes { 50 | long long space = [[[[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemSize] longLongValue]; 51 | return space; 52 | } 53 | 54 | + (CGFloat)freeDiskSpaceInBytes { 55 | long long freeSpace = [[[[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemFreeSize] longLongValue]; 56 | return freeSpace; 57 | } 58 | 59 | + (CGFloat)usedDiskSpaceInBytes { 60 | long long usedSpace = [self totalDiskSpaceInBytes] - [self freeDiskSpaceInBytes]; 61 | return usedSpace; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/xcshareddata/xcschemes/ALSystemUtilities.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/xcuserdata/AL08.xcuserdatad/xcschemes/ALSystemUtilities.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALNetwork/ALNetwork.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALNetwork.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import "Reachability.h" 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | @protocol ALNetworkDelegate 20 | 21 | /*! 链接下载速度的回调,返回的是下载速度 22 | Called when the connection speed test has finished 23 | @param downloadSpeedInKbPerSeconds NSString value which represents the speed connection 24 | */ 25 | - (void)downloadSpeedTestFinished:(NSString *)downloadSpeedInKbPerSeconds; 26 | 27 | @end 28 | 29 | /*! 30 | * This class provide methods to get current IP address and check WiFi or 3G connection 31 | */ 32 | @interface ALNetwork : NSObject 33 | 34 | /*! 35 | * The delegate of the object 36 | */ 37 | @property id delegate; 38 | 39 | + (ALNetwork *)sharedInstance; 40 | 41 | /*! 获取当前IP地址 42 | Get the current IP address 43 | @return NSString value which represents the current IP address 44 | */ 45 | + (NSString *)currentIPAddress; 46 | 47 | /*! 检查当前链接是否为WiFi 48 | Check if the device is connected to WiFi 49 | @return YES if the device is connected to WiFi network, NO if it isn't 50 | */ 51 | + (BOOL)connectedViaWiFi; 52 | 53 | /*! 检查当前链接是否为3G 54 | Check if the device is connected to 3G 55 | @return YES if the device is connected to 3G network, NO if it isn't 56 | */ 57 | + (BOOL)connectedVia3G; 58 | 59 | /*! 获取iPhone的物理地址 60 | Get the MAC Address of the iPhone 61 | @return NSString represents the MAC address 62 | */ 63 | + (NSString *)macAddress; 64 | 65 | /*! 开始测试下载速度 66 | Start the test for the speed of the connection 67 | */ 68 | - (void)downloadSpeedInKbPerSec; 69 | 70 | /*! 获取外部IP地址 71 | * The external IP Address 72 | @return NSString represents the external IP address 73 | */ 74 | + (NSString *)externalIPAddress; 75 | 76 | /*! 获取小单位的IP地址 77 | * The cell IP address 78 | @return NSString represents the cell IP address 79 | */ 80 | + (NSString *)cellIPAddress; 81 | 82 | /*! 获取WiFI 网络掩码地址 83 | * The WiFi netmask address 84 | @return NSString represents the WiFi netmask address 85 | */ 86 | + (NSString *)WiFiNetmaskAddress; 87 | 88 | /*! 获取WiFi的广播地址 89 | * The WiFi broadcast address 90 | @return NSString represents the WiFi broadcast address 91 | */ 92 | + (NSString *)WiFiBroadcastAddress; 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALBattery/ALBattery.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALBattery.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 18/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "ALHardware.h" 12 | 13 | /*! 14 | * This class is useful to retrieve informations about the battery status 15 | */ 16 | 17 | @interface ALBattery : NSObject 18 | 19 | /*! 20 | ---------------------------- 21 | /// @name Methods 22 | ---------------------------- 23 | */ 24 | 25 | /*! 检查电池是否充满电 26 | Check if the battery is fully charged 27 | @return YES if the battery is fully charged, NO if it isn't 28 | */ 29 | + (BOOL)batteryFullCharged; 30 | 31 | /*! 检查是否在充电中 32 | Check if the battery is charging 33 | @return YES if the battery is charging, NO if it isn't 34 | */ 35 | + (BOOL)inCharge; 36 | 37 | /*! 检查设备被插入电源 38 | Check if the device is plugged into power 39 | @return YES if the device is plugged into power, NO if it isn't 40 | */ 41 | + (BOOL)devicePluggedIntoPower; 42 | 43 | /*! 电池状态 44 | The battery state of the device 45 | @return UIDeviceBatteryState value which represent the current status of the battery 46 | */ 47 | + (UIDeviceBatteryState)batteryState; 48 | 49 | /*! 电池电量 50 | Retrieve the battery level of the battery 51 | @return A CGFloat value which represents the current battery level 52 | */ 53 | + (CGFloat)batteryLevel; 54 | 55 | /*! 剩下备用还有几个小时 56 | The remaining hours for standby 57 | @return NSString represents the remaining hours for standby 58 | */ 59 | + (NSString *)remainingHoursForStandby; 60 | 61 | /*! 3 g的通话 剩下几个小时 62 | The remaining hours for 3g conversation 63 | @return NSString represents the remaining hours for 3g conversation 64 | */ 65 | + (NSString *)remainingHoursFor3gConversation; 66 | 67 | /*! 2 g的通话 剩下几个小时 68 | The remaining hours for 2g conversation 69 | @return NSString represents the remaining hours for 2g conversation 70 | */ 71 | + (NSString *)remainingHoursFor2gConversation; 72 | 73 | /*! 3 g网络导航 剩下几个小时 74 | The remaining hours for 3g internet navigation 75 | @return NSString represents the remaining hours for 3g internet navigation 76 | */ 77 | + (NSString *)remainingHoursForInternet3g; 78 | 79 | /*! Wifi 网络导航 剩下几个小时 80 | The remaining hours for WiFi internet navigation 81 | @return NSString represents the remaining hours for WiFi internet navigation 82 | */ 83 | + (NSString *)remainingHoursForInternetWiFi; 84 | 85 | /*! 用户视频复制 剩下的时间 86 | The remaining hours for video reproduction 87 | @return NSString represents the remaining hours for video reproduction 88 | */ 89 | + (NSString *)remainingHoursForVideo; 90 | 91 | /*! 用于语音复制 剩下的时间 92 | The remaining hours for audio reproduction 93 | @return NSString represents the remaining hours for reproduction 94 | */ 95 | + (NSString *)remainingHoursForAudio; 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystem/ALSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 09/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ALBattery.h" 11 | #import "ALDisk.h" 12 | #import "ALHardware.h" 13 | #import "ALJailbreak.h" 14 | #import "ALLocalization.h" 15 | #import "ALMemory.h" 16 | #import "ALNetwork.h" 17 | #import "ALProcessor.h" 18 | #import "ALCarrier.h" 19 | #import "ALAccessory.h" 20 | #import "ALSystemConstants.h" 21 | 22 | 23 | /*! 24 | * This class imports all the other classes of the ALSystemUtilities library, so you can import only ALSystem.h to import all the library. 25 | * ALSystem provides methods to get the informations about every specific purview in a NSDictionary object which keys are declared in the relative extension header of ALSystem. 26 | */ 27 | @interface ALSystem : NSObject 28 | 29 | /*! 系统信息 30 | All the informations of the library 31 | @return NSDictionary which contains all informations the library can provides 32 | */ 33 | + (NSDictionary *)systemInformations; 34 | 35 | /*! 电池信息 36 | All the informations about the battery 37 | @return NSDictionary which contains all informations about the battery 38 | */ 39 | + (NSDictionary *)batteryInformations; 40 | 41 | /*! 磁盘信息 42 | All the informations about the disk 43 | @return NSDictionary which contains all informations about the disk 44 | */ 45 | + (NSDictionary *)diskInformations; 46 | 47 | /*! 硬件信息 48 | All the informations about the hardware 49 | @return NSDictionary which contains all informations about the hardware 50 | */ 51 | + (NSDictionary *)hardwareInformations; 52 | 53 | /*! 越狱信息 54 | All the informations about the jailbreak 55 | @return NSDictionary which contains all informations about the jailbreak 56 | */ 57 | + (NSDictionary *)jailbreakInformations; 58 | 59 | /*! 本地化信息 60 | All the informations about the localization 61 | @return NSDictionary which contains all informations about the localization 62 | */ 63 | + (NSDictionary *)localizationInformations; 64 | 65 | /*! 内存信息 66 | All the informations about the memory 67 | @return NSDictionary which contains all informations about the memory 68 | */ 69 | + (NSDictionary *)memoryInformations; 70 | 71 | /*!网络信息 72 | All the informations about the network 73 | @return NSDictionary which contains all informations about the network 74 | */ 75 | + (NSDictionary *)networkInformations; 76 | 77 | /*! 处理器信息 78 | All the informations avout the processor 79 | @return NSDictionary which contains all informations about the processor 80 | */ 81 | + (NSDictionary *)processorInformations; 82 | 83 | /*! 载体信息 84 | All the informations acout the carrier 85 | @return NSDictionary which contains all informations about the carrier 86 | */ 87 | + (NSDictionary *)carrierInformations; 88 | 89 | /*! 附件信息 90 | All the informations about the accessories 91 | @return NSDictionary which contains all informations about the accessories 92 | */ 93 | + (NSDictionary *)accessoryInformations; 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALMemory/ALMemory.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALMemory.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALMemory.h" 10 | 11 | @implementation ALMemory 12 | 13 | + (NSInteger)totalMemory { 14 | int nearest = 256; 15 | int totalMemory = [[NSProcessInfo processInfo] physicalMemory] / 1024 / 1024; 16 | int rem = (int)totalMemory % nearest; 17 | int tot = 0; 18 | if (rem >= nearest/2) { 19 | tot = ((int)totalMemory - rem)+256; 20 | } else { 21 | tot = ((int)totalMemory - rem); 22 | } 23 | 24 | return tot; 25 | } 26 | 27 | + (CGFloat)freeMemory { 28 | double totalMemory = 0.00; 29 | vm_statistics_data_t vmStats; 30 | mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; 31 | kern_return_t kernReturn = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmStats, &infoCount); 32 | if(kernReturn != KERN_SUCCESS) { 33 | return -1; 34 | } 35 | totalMemory = ((vm_page_size * vmStats.free_count) / 1024) / 1024; 36 | 37 | return totalMemory; 38 | } 39 | 40 | + (CGFloat)usedMemory { 41 | double usedMemory = 0.00; 42 | vm_statistics_data_t vmStats; 43 | mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; 44 | kern_return_t kernReturn = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmStats, &infoCount); 45 | if(kernReturn != KERN_SUCCESS) { 46 | return -1; 47 | } 48 | usedMemory = ((vm_page_size * (vmStats.active_count + vmStats.inactive_count + vmStats.wire_count)) / 1024) / 1024; 49 | 50 | return usedMemory; 51 | } 52 | 53 | + (CGFloat)activeMemory { 54 | double activeMemory = 0.00; 55 | vm_statistics_data_t vmStats; 56 | mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; 57 | kern_return_t kernReturn = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmStats, &infoCount); 58 | if(kernReturn != KERN_SUCCESS) { 59 | return -1; 60 | } 61 | activeMemory = ((vm_page_size * vmStats.active_count) / 1024) / 1024; 62 | 63 | return activeMemory; 64 | } 65 | 66 | + (CGFloat)wiredMemory { 67 | double wiredMemory = 0.00; 68 | vm_statistics_data_t vmStats; 69 | mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; 70 | kern_return_t kernReturn = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmStats, &infoCount); 71 | if(kernReturn != KERN_SUCCESS) { 72 | return -1; 73 | } 74 | wiredMemory = ((vm_page_size * vmStats.wire_count) / 1024) / 1024; 75 | 76 | return wiredMemory; 77 | } 78 | 79 | + (CGFloat)inactiveMemory { 80 | double inactiveMemory = 0.00; 81 | vm_statistics_data_t vmStats; 82 | mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; 83 | kern_return_t kernReturn = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmStats, &infoCount); 84 | if(kernReturn != KERN_SUCCESS) { 85 | return -1; 86 | } 87 | inactiveMemory = ((vm_page_size * vmStats.inactive_count) / 1024) / 1024; 88 | 89 | return inactiveMemory; 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALHardware/ALHardware.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALHardware.h 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import 10 | #include 11 | #include 12 | #include 13 | 14 | /*! 15 | * This class check some hardware (and software) informations 16 | */ 17 | @interface ALHardware : NSObject 18 | 19 | /*! 获取设备模型 20 | Check the device model 21 | @return NSString with the device model 22 | */ 23 | + (NSString *)deviceModel; 24 | 25 | /*! 获取设备名字 26 | Check the device name 27 | @return NSString with the device name 28 | */ 29 | + (NSString *)deviceName; 30 | 31 | /*! 获取系统名字 32 | Check the system name 33 | @return NSString with the system name 34 | */ 35 | + (NSString *)systemName; 36 | 37 | /*! 获取系统版本 38 | Check the system version 39 | @return NSString with the system version 40 | */ 41 | + (NSString *)systemVersion; 42 | 43 | /*! 获取屏幕宽度的像素 44 | Check the screen width in pixel 45 | @return NSInteger value of the width of the screen 46 | */ 47 | + (NSInteger)screenWidth; 48 | 49 | /*! 获取屏幕高度的像素 50 | Check the screen height in pixel 51 | @return NSInteger value of the height of the screen 52 | */ 53 | + (NSInteger)screenHeight; 54 | 55 | /*! 获取屏幕的亮度 56 | Check the screen brightness 57 | @return CGFloat value of the brightness of the screen 58 | */ 59 | + (CGFloat)brightness; 60 | 61 | /*! 获取硬件的类型 62 | Get the device type 63 | @return NSString represents the platform type (ex. : iPhone 5) 64 | */ 65 | + (NSString *)platformType; 66 | 67 | /*! 获取启动时间的时、分、秒 68 | Get the boot time in hours, minutes and seconds 69 | @return NSString represents the boot time in hours, minutes and seconds 70 | */ 71 | + (NSDate *)bootTime; 72 | 73 | /*! 检查是否存在传感器 74 | Check for the proximity sensor 75 | @return YES if the proximity sensor exist, NO if it isn't 76 | */ 77 | + (BOOL)proximitySensor; 78 | 79 | /*! 检查是否启用了多任务处理是否开启 80 | Check if the multitasking is enabled 81 | @return YES if the multitasking is enabled, NO if it isn't 82 | */ 83 | + (BOOL)multitaskingEnabled; 84 | 85 | // 1.2 86 | 87 | /*! 获取仿真类型 88 | The sim type 89 | @return NSString with the sim type 90 | */ 91 | + (NSString *)sim; 92 | 93 | /*! 获取硬件的外形尺寸 94 | The device's dimensions 95 | @return NSString with the dimensions 96 | */ 97 | + (NSString *)dimensions; 98 | 99 | /*! 获取硬件的重量 100 | The weight of the device 101 | @return NSString with the weight of the device 102 | */ 103 | + (NSString *)weight; 104 | 105 | /*! 获取硬件的显示类型 106 | The display type of the device 107 | @return NSString with the display type 108 | */ 109 | + (NSString *)displayType; 110 | 111 | /*! 获取显示的密度 112 | The display density 113 | @return NSString with the display density 114 | */ 115 | + (NSString *)displayDensity; 116 | 117 | /*! 获取WLAN类型 118 | The WLAN type 119 | @return NSString with the WLAN type 120 | */ 121 | + (NSString *)WLAN; 122 | 123 | /*! 获取蓝牙版本 124 | The bluetooth version 125 | @return NSString with the bluetooth version 126 | */ 127 | + (NSString *)bluetooth; 128 | 129 | /*! 获取硬件原生摄像机的详情 130 | Details about primary camera of the device 131 | @return NSString with details about primary camera 132 | */ 133 | + (NSString *)cameraPrimary; 134 | 135 | /*! 获取硬件第二摄像机的详情 136 | Details about secondary camera of the device 137 | @return NSString with details about secondary camera 138 | */ 139 | + (NSString *)cameraSecondary; 140 | 141 | /*! 获取硬件的cpu 142 | The cpu of the device 143 | @return NSString with the cpu of the device 144 | */ 145 | + (NSString *)cpu; 146 | 147 | /*! 获取硬件的gpu 148 | The gpu of the device 149 | @return NSString with the gpu of the device 150 | */ 151 | + (NSString *)gpu; 152 | 153 | /*! 检查 当前是否在使用siri 154 | Check for Siri 155 | @return YES if Siri is present, NO if it isn't 156 | */ 157 | + (BOOL)siri; 158 | 159 | /*! 检查是否有指纹识别 160 | Check for the Touch ID 161 | @return YES if Touch ID is present, NO if it isn't 162 | */ 163 | + (BOOL)touchID; 164 | 165 | @end 166 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Reachability/Reachability.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | File: Reachability.h 4 | Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs. 5 | 6 | Version: 2.2 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. 9 | ("Apple") in consideration of your agreement to the following terms, and your 10 | use, installation, modification or redistribution of this Apple software 11 | constitutes acceptance of these terms. If you do not agree with these terms, 12 | please do not use, install, modify or redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and subject 15 | to these terms, Apple grants you a personal, non-exclusive license, under 16 | Apple's copyrights in this original Apple software (the "Apple Software"), to 17 | use, reproduce, modify and redistribute the Apple Software, with or without 18 | modifications, in source and/or binary forms; provided that if you redistribute 19 | the Apple Software in its entirety and without modifications, you must retain 20 | this notice and the following text and disclaimers in all such redistributions 21 | of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may be used 23 | to endorse or promote products derived from the Apple Software without specific 24 | prior written permission from Apple. Except as expressly stated in this notice, 25 | no other rights or licenses, express or implied, are granted by Apple herein, 26 | including but not limited to any patent rights that may be infringed by your 27 | derivative works or by other works in which the Apple Software may be 28 | incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO 31 | WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED 32 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 33 | PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN 34 | COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR 37 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39 | ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR 40 | DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF 41 | CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF 42 | APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2010 Apple Inc. All Rights Reserved. 45 | 46 | */ 47 | 48 | 49 | #import 50 | #import 51 | 52 | typedef enum { 53 | NotReachable = 0, 54 | ReachableViaWiFi, 55 | ReachableViaWWAN 56 | } NetworkStatus; 57 | #define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification" 58 | 59 | @interface Reachability: NSObject 60 | { 61 | BOOL localWiFiRef; 62 | SCNetworkReachabilityRef reachabilityRef; 63 | } 64 | 65 | // 用来检查可达性的一个特定的主机名 66 | //reachabilityWithHostName- Use to check the reachability of a particular host name. 67 | + (Reachability*) reachabilityWithHostName: (NSString*) hostName; 68 | 69 | // 用来检查一个特定的IP地址可达性 70 | //reachabilityWithAddress- Use to check the reachability of a particular IP address. 71 | + (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress; 72 | 73 | //reachabilityForInternetConnection- checks whether the default route is available. 检查是否可用默认路由 74 | // Should be used by applications that do not connect to a particular host 应该使用应用程序连接到一个特定的主机 75 | + (Reachability*) reachabilityForInternetConnection; 76 | 77 | //reachabilityForLocalWiFi- checks whether a local wifi connection is available. 检查是否一个当地wifi连接可用 78 | + (Reachability*) reachabilityForLocalWiFi; 79 | 80 | //Start listening for reachability notifications on the current run loop 开始监听可达性通知当前运行循环 81 | - (BOOL) startNotifier; 82 | - (void) stopNotifier; 83 | 84 | - (NetworkStatus) currentReachabilityStatus; // 当前网络状态 85 | //WWAN may be available, but not active until a connection has been established. 86 | //WiFi may require a connection for VPN on Demand. 87 | - (BOOL) connectionRequired; // 88 | @end 89 | 90 | 91 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALProcessor/ALProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALProcessor.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALProcessor.h" 10 | 11 | @implementation ALProcessor 12 | 13 | + (NSInteger)processorsNumber { 14 | return [[NSProcessInfo processInfo] processorCount]; 15 | } 16 | 17 | + (NSInteger)activeProcessorsNumber { 18 | return [[NSProcessInfo processInfo] activeProcessorCount]; 19 | } 20 | 21 | // Credit to: http://stackoverflow.com/questions/8223348/ios-get-cpu-usage-from-application 22 | + (CGFloat)cpuUsageForApp { 23 | kern_return_t kr; 24 | task_info_data_t tinfo; 25 | mach_msg_type_number_t task_info_count; 26 | 27 | task_info_count = TASK_INFO_MAX; 28 | kr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)tinfo, &task_info_count); 29 | if (kr != KERN_SUCCESS) 30 | return -1; 31 | 32 | task_basic_info_t basic_info; 33 | thread_array_t thread_list; 34 | mach_msg_type_number_t thread_count; 35 | thread_info_data_t thinfo; 36 | mach_msg_type_number_t thread_info_count; 37 | thread_basic_info_t basic_info_th; 38 | uint32_t stat_thread = 0; // Mach threads 39 | 40 | basic_info = (task_basic_info_t)tinfo; 41 | 42 | // get threads in the task 43 | kr = task_threads(mach_task_self(), &thread_list, &thread_count); 44 | if (kr != KERN_SUCCESS) 45 | return -1; 46 | if (thread_count > 0) 47 | stat_thread += thread_count; 48 | 49 | long tot_sec = 0; 50 | long tot_usec = 0; 51 | float tot_cpu = 0; 52 | int j; 53 | 54 | for (j = 0; j < thread_count; j++) { 55 | thread_info_count = THREAD_INFO_MAX; 56 | kr = thread_info(thread_list[j], THREAD_BASIC_INFO, 57 | (thread_info_t)thinfo, &thread_info_count); 58 | if (kr != KERN_SUCCESS) 59 | return -1; 60 | 61 | basic_info_th = (thread_basic_info_t)thinfo; 62 | if (!(basic_info_th->flags & TH_FLAGS_IDLE)) { 63 | tot_sec = tot_sec + basic_info_th->user_time.seconds + basic_info_th->system_time.seconds; 64 | tot_usec = tot_usec + basic_info_th->system_time.microseconds + basic_info_th->system_time.microseconds; 65 | tot_cpu = tot_cpu + basic_info_th->cpu_usage / (float)TH_USAGE_SCALE; 66 | } 67 | 68 | } // for each thread 69 | 70 | return tot_cpu; 71 | } 72 | 73 | + (NSArray *)activeProcesses { 74 | int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0}; 75 | size_t miblen = 4; 76 | size_t size; 77 | int st = sysctl(mib, miblen, NULL, &size, NULL, 0); 78 | struct kinfo_proc * process = NULL; 79 | struct kinfo_proc * newprocess = NULL; 80 | do { 81 | 82 | size += size / 10; 83 | newprocess = realloc(process, size); 84 | if (!newprocess) { 85 | if (process) { 86 | free(process); 87 | } 88 | return nil; 89 | } 90 | process = newprocess; 91 | st = sysctl(mib, miblen, process, &size, NULL, 0); 92 | 93 | } while (st == -1 && errno == ENOMEM); 94 | 95 | if (st == 0) { 96 | if (size % sizeof(struct kinfo_proc) == 0){ 97 | int nprocess = size / sizeof(struct kinfo_proc); 98 | if (nprocess) { 99 | NSMutableArray * array = [[NSMutableArray alloc] init]; 100 | for (int i = nprocess - 1; i >= 0; i--) { 101 | NSString * processID = [[NSString alloc] initWithFormat:@"%d", process[i].kp_proc.p_pid]; 102 | NSString * processName = [[NSString alloc] initWithFormat:@"%s", process[i].kp_proc.p_comm]; 103 | NSDictionary * dict = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects:processID, processName, nil] 104 | forKeys:[NSArray arrayWithObjects:@"ProcessID", @"ProcessName", nil]]; 105 | [array addObject:dict]; 106 | } 107 | free(process); 108 | return array; 109 | } 110 | } 111 | } 112 | 113 | return nil; 114 | } 115 | 116 | + (NSInteger)numberOfActiveProcesses { 117 | return [[self activeProcesses] count]; 118 | } 119 | 120 | @end 121 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ALSystemUtilities 2 | ================= 3 | 4 | In order to use the framework you have to open the project in Xcode and then click on Product -> Archive and drag the .framework file into the project you want to import it. 5 | 6 | The project is built using the iOS Universal Framework template (Fake framework) by kstenerud (https://github.com/kstenerud/iOS-Universal-Framework?source=cc). 7 | 8 | Overview 9 | ================= 10 | 11 | The library provides informations for these purviews : 12 | 13 | - battery; 14 | - disk; 15 | - hardware; 16 | - jailbreak; 17 | - localization; 18 | - memory (RAM); 19 | - network; 20 | - processor; 21 | - carrier; 22 | - accessories; 23 | 24 | Now I'll explain you what informations are contained for every purview. 25 | 26 | 27 | *Battery* 28 | 29 | - ```+ (BOOL)batteryFullCharged;``` 30 | - ```+ (BOOL)inCharge;``` 31 | - ```+ (BOOL)devicePluggedIntoPower;``` 32 | - ```+ (UIDeviceBatteryState)batteryState;``` 33 | - ```+ (CGFloat)batteryLevel;``` 34 | - ```+ (NSString *)remainingHoursForStandby;``` 35 | - ```+ (NSString *)remainingHoursFor3gConversation;``` 36 | - ```+ (NSString *)remainingHoursFor2gConversation;``` 37 | - ```+ (NSString *)remainingHoursForInternet3g;``` 38 | - ```+ (NSString *)remainingHoursForInternetWiFi;``` 39 | - ```+ (NSString *)remainingHoursForVideo;``` 40 | - ```+ (NSString *)remainingHoursForAudio;``` 41 | 42 | *Disk* 43 | 44 | - ```+ (NSString *)totalDiskSpace;``` 45 | - ```+ (NSString *)freeDiskSpace;``` 46 | - ```+ (NSString *)usedDiskSpace;``` 47 | - ```+ (CGFloat)totalDiskSpaceInBytes;``` 48 | - ```+ (CGFloat)freeDiskSpaceInBytes;``` 49 | - ```+ (CGFloat)usedDiskSpaceInBytes;``` 50 | 51 | *Hardware* 52 | 53 | - ```+ (NSString *)deviceModel;``` 54 | - ```+ (NSString *)deviceName;``` 55 | - ```+ (NSString *)systemName;``` 56 | - ```+ (NSString *)systemVersion;``` 57 | - ```+ (NSInteger)screenWidth;``` 58 | - ```+ (NSInteger)screenHeight;``` 59 | - ```+ (CGFloat)brightness;``` 60 | - ```+ (NSString *)platformType;``` 61 | - ```+ (NSDate *)bootTime;``` 62 | - ```+ (BOOL)proximitySensor;``` 63 | - ```+ (BOOL)multitaskingEnabled;``` 64 | - ```+ (NSString *)sim;``` 65 | - ```+ (NSString *)dimensions;``` 66 | - ```+ (NSString *)weight;``` 67 | - ```+ (NSString *)displayType;``` 68 | - ```+ (NSString *)displayDensity;``` 69 | - ```+ (NSString *)WLAN;``` 70 | - ```+ (NSString *)bluetooth;``` 71 | - ```+ (NSString *)cameraPrimary;``` 72 | - ```+ (NSString *)cameraSecondary;``` 73 | - ```+ (NSString *)cpu;``` 74 | - ```+ (NSString *)gpu;``` 75 | - ```+ (BOOL)siri;``` 76 | - ```+ (BOOL)touchID;``` 77 | 78 | *Jailbreak* 79 | 80 | - ```+ (BOOL)isJailbroken;``` 81 | 82 | *Localization* 83 | 84 | - ```+ (NSString *)language;``` 85 | - ```+ (NSString *)timeZone;``` 86 | - ```+ (NSString *)currencySymbol;``` 87 | - ```+ (NSString *)currencyCode;``` 88 | - ```+ (NSString *)country;``` 89 | - ```+ (NSString *)measurementSystem;``` 90 | 91 | *Memory (RAM)* 92 | 93 | - ```+ (NSInteger)totalMemory;``` 94 | - ```+ (CGFloat)freeMemory;``` 95 | - ```+ (CGFloat)usedMemory;``` 96 | - ```+ (CGFloat)activeMemory;``` 97 | - ```+ (CGFloat)wiredMemory;``` 98 | - ```+ (CGFloat)inactiveMemory;``` 99 | 100 | *Network* 101 | 102 | - ```+ (NSString *)currentIPAddress;``` 103 | - ```+ (BOOL)connectedViaWiFi;``` 104 | - ```+ (BOOL)connectedVia3G;``` 105 | - ```+ (NSString *)macAddress;``` 106 | - ```+ (NSString *)externalIPAddress;``` 107 | - ```+ (NSString *)cellIPAddress;``` 108 | - ```+ (NSString *)WiFiNetmaskAddress;``` 109 | - ```+ (NSString *)WiFiBroadcastAddress;``` 110 | 111 | *Processor* 112 | 113 | - ```+ (NSInteger)processorsNumber;``` 114 | - ```+ (NSInteger)activeProcessorsNumber;``` 115 | - ```+ (CGFloat)cpuUsageForApp;``` 116 | - ```+ (NSArray *)activeProcesses;``` 117 | - ```+ (NSInteger)numberOfActiveProcesses;``` 118 | 119 | *Carrier* 120 | 121 | - ```+ (NSString *)carrierName;``` 122 | - ```+ (NSString *)carrierISOCountryCode;``` 123 | - ```+ (NSString *)carrierMobileCountryCode;``` 124 | - ```+ (NSString *)carrierMobileNetworkCode;``` 125 | - ```+ (BOOL)carrierAllowsVOIP;``` 126 | 127 | *Accessories* 128 | 129 | - ```+ (BOOL)accessoriesPluggedIn;``` 130 | - ```+ (NSInteger)numberOfAccessoriesPluggedIn;``` 131 | - ```+ (BOOL)isHeadphonesAttached;``` 132 | 133 | So, there are 78 methods to get every kind of information! 134 | 135 | All methods are class methods, so you can use the syntax ```[ALCarrier carrierName]```. This make the use of the library very very simple! 136 | 137 | If you want to let me know if you use my library in your applications, you are free to send me an email to andrea.lufino@me.com :) -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALHardware/ALHardware.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALHardware.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALHardware.h" 10 | 11 | #define MIB_SIZE 2 12 | 13 | @interface ALHardware () 14 | 15 | + (NSDictionary *)infoForDevice; 16 | 17 | @end 18 | 19 | @implementation ALHardware 20 | 21 | #pragma mark - Info for device 22 | 23 | + (NSDictionary *)infoForDevice { 24 | NSString *device = [ALHardware platformType]; 25 | NSDictionary *info = [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[device stringByReplacingOccurrencesOfString:@" " withString:@""] ofType:@"plist"]]; 26 | return info; 27 | } 28 | 29 | #pragma mark - Methods 30 | 31 | + (NSString *)deviceModel { 32 | return [[UIDevice currentDevice] model]; 33 | } 34 | 35 | + (NSString *)deviceName { 36 | return [[UIDevice currentDevice] name]; 37 | } 38 | 39 | + (NSString *)systemName { 40 | return [[UIDevice currentDevice] systemName]; 41 | } 42 | 43 | + (NSString *)systemVersion { 44 | return [[UIDevice currentDevice] systemVersion]; 45 | } 46 | 47 | + (NSInteger)screenWidth { 48 | return [[UIScreen mainScreen] bounds].size.width; 49 | } 50 | 51 | + (NSInteger)screenHeight { 52 | return [[UIScreen mainScreen] bounds].size.height; 53 | } 54 | 55 | + (CGFloat)brightness { 56 | return [[UIScreen mainScreen] brightness]*100; 57 | } 58 | 59 | + (NSString *)platformType { 60 | struct utsname systemInfo; 61 | uname(&systemInfo); 62 | NSString *result = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; 63 | NSString *type; 64 | if ([result isEqualToString:@"i386"]) type = @"Simulator"; 65 | if ([result isEqualToString:@"iPod3,1"]) type = @"iPod Touch 3"; 66 | if ([result isEqualToString:@"iPod4,1"]) type = @"iPod Touch 4"; 67 | if ([result isEqualToString:@"iPod5,1"]) type = @"iPod Touch 5"; 68 | if ([result isEqualToString:@"iPhone2,1"]) type = @"iPhone 3Gs"; 69 | if ([result isEqualToString:@"iPhone3,1"]) type = @"iPhone 4"; 70 | if ([result isEqualToString:@"iPhone4,1"]) type = @"iPhone 4s"; 71 | if ([result isEqualToString:@"iPhone5,1"] || 72 | [result isEqualToString:@"iPhone5,2"]) type = @"iPhone 5"; 73 | if ([result isEqualToString:@"iPad2,1"] || 74 | [result isEqualToString:@"iPad2,2"] || 75 | [result isEqualToString:@"iPad2,3"]) type = @"iPad 2"; 76 | if ([result isEqualToString:@"iPad3,1"] || 77 | [result isEqualToString:@"iPad3,2"] || 78 | [result isEqualToString:@"iPad3,3"]) type = @"iPad 3"; 79 | if ([result isEqualToString:@"iPad3,4"] || 80 | [result isEqualToString:@"iPad3,5"] || 81 | [result isEqualToString:@"iPad3,6"]) type = @"iPad 4"; 82 | if ([result isEqualToString:@"iPad2,5"] || 83 | [result isEqualToString:@"iPad2,6"] || 84 | [result isEqualToString:@"iPad2,7"]) type = @"iPad Mini"; 85 | if ([result isEqualToString:@"iPhone6,1"] || 86 | [result isEqualToString:@"iPhone6,2"]) type = @"iPhone 5s"; 87 | if ([result isEqualToString:@"iPhone5,3"] || 88 | [result isEqualToString:@"iPhone5,4"]) type = @"iPhone 5c"; 89 | 90 | return type; 91 | } 92 | 93 | + (NSString *)bootTime { 94 | NSInteger ti = (NSInteger)[[NSProcessInfo processInfo] systemUptime]; 95 | NSInteger seconds = ti % 60; 96 | NSInteger minutes = (ti / 60) % 60; 97 | NSInteger hours = (ti / 3600); 98 | return [NSString stringWithFormat:@"%02i:%02i:%02i", hours, minutes, seconds]; 99 | } 100 | 101 | + (BOOL)proximitySensor { 102 | // Make a Bool for the proximity Sensor 103 | BOOL proximitySensor = NO; 104 | // Is the proximity sensor enabled? 105 | if ([[UIDevice currentDevice] respondsToSelector:@selector(setProximityMonitoringEnabled:)]) { 106 | // Create a UIDevice variable 107 | UIDevice *device = [UIDevice currentDevice]; 108 | // Turn the sensor on, if not already on, and see if it works 109 | if (device.proximityMonitoringEnabled != YES) { 110 | // Sensor is off 111 | // Turn it on 112 | [device setProximityMonitoringEnabled:YES]; 113 | // See if it turned on 114 | if (device.proximityMonitoringEnabled == YES) { 115 | // It turned on! Turn it off 116 | [device setProximityMonitoringEnabled:NO]; 117 | // It works 118 | proximitySensor = YES; 119 | } else { 120 | // Didn't turn on, no good 121 | proximitySensor = NO; 122 | } 123 | } else { 124 | // Sensor is already on 125 | proximitySensor = YES; 126 | } 127 | } 128 | // Return on or off 129 | return proximitySensor; 130 | } 131 | 132 | + (BOOL)multitaskingEnabled { 133 | // Is multitasking enabled? 134 | if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]) { 135 | // Create a bool 136 | BOOL multitaskingSupported = [UIDevice currentDevice].multitaskingSupported; 137 | // Return the value 138 | return multitaskingSupported; 139 | } else { 140 | // Doesn't respond to selector 141 | return NO; 142 | } 143 | } 144 | 145 | // 1.2 146 | 147 | + (NSString *)sim { 148 | return [[self infoForDevice] objectForKey:@"sim"]; 149 | } 150 | 151 | + (NSString *)dimensions { 152 | return [[self infoForDevice] objectForKey:@"dimensions"]; 153 | } 154 | 155 | + (NSString *)weight { 156 | return [[self infoForDevice] objectForKey:@"weight"]; 157 | } 158 | 159 | + (NSString *)displayType { 160 | return [[self infoForDevice] objectForKey:@"display-type"]; 161 | } 162 | 163 | + (NSString *)displayDensity { 164 | return [[self infoForDevice] objectForKey:@"display-density"]; 165 | } 166 | 167 | + (NSString *)WLAN { 168 | return [[self infoForDevice] objectForKey:@"WLAN"]; 169 | } 170 | 171 | + (NSString *)bluetooth { 172 | return [[self infoForDevice] objectForKey:@"bluetooth"]; 173 | } 174 | 175 | + (NSString *)cameraPrimary { 176 | return [[self infoForDevice] objectForKey:@"camera-primary"]; 177 | } 178 | 179 | + (NSString *)cameraSecondary { 180 | return [[self infoForDevice] objectForKey:@"camera-secondary"]; 181 | } 182 | 183 | + (NSString *)cpu { 184 | return [[self infoForDevice] objectForKey:@"cpu"]; 185 | } 186 | 187 | + (NSString *)gpu { 188 | return [[self infoForDevice] objectForKey:@"gpu"]; 189 | } 190 | 191 | + (BOOL)siri { 192 | if ([[[self infoForDevice] objectForKey:@"siri"] isEqualToString:@"Yes"]) 193 | return YES; 194 | else 195 | return NO; 196 | } 197 | 198 | + (BOOL)touchID { 199 | if ([[[self infoForDevice] objectForKey:@"touch-id"] isEqualToString:@"Yes"]) 200 | return YES; 201 | else 202 | return NO; 203 | } 204 | 205 | @end 206 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALBattery/ALBattery.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALBattery.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 18/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALBattery.h" 10 | 11 | @interface ALBattery () 12 | 13 | + (UIDevice *)device; 14 | + (NSDictionary *)infoForDevice; 15 | 16 | @end 17 | 18 | @implementation ALBattery 19 | 20 | #pragma mark - UIDevice 21 | 22 | + (UIDevice *)device { 23 | [UIDevice currentDevice].batteryMonitoringEnabled = YES; 24 | return [UIDevice currentDevice]; 25 | } 26 | 27 | #pragma mark - Info for device 28 | 29 | + (NSDictionary *)infoForDevice { 30 | NSString *device = [ALHardware platformType]; 31 | NSDictionary *info = [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[device stringByReplacingOccurrencesOfString:@" " withString:@""] ofType:@"plist"]]; 32 | return info; 33 | } 34 | 35 | #pragma mark - Battery methods 36 | 37 | + (BOOL)batteryFullCharged { 38 | if ([self batteryLevel] == 100.00) { 39 | return YES; 40 | } else { 41 | return NO; 42 | } 43 | } 44 | 45 | + (BOOL)inCharge { 46 | if ([self device].batteryState == UIDeviceBatteryStateCharging || 47 | [self device].batteryState == UIDeviceBatteryStateFull) { 48 | return YES; 49 | } else { 50 | return NO; 51 | } 52 | } 53 | 54 | + (BOOL)devicePluggedIntoPower { 55 | if ([self device].batteryState == UIDeviceBatteryStateUnplugged) { 56 | return NO; 57 | } else { 58 | return YES; 59 | } 60 | } 61 | 62 | + (UIDeviceBatteryState)batteryState { 63 | return [self device].batteryState; 64 | } 65 | 66 | + (CGFloat)batteryLevel { 67 | CGFloat batteryLevel = 0.0f; 68 | CGFloat batteryCharge = [self device].batteryLevel; 69 | if (batteryCharge > 0.0f) 70 | batteryLevel = batteryCharge * 100; 71 | else 72 | // Unable to find battery level 73 | return -1; 74 | 75 | return batteryLevel; 76 | } 77 | 78 | + (NSString *)remainingHoursForStandby { 79 | CGFloat batteryLevel = [self batteryLevel]; 80 | NSDictionary *info = [self infoForDevice]; 81 | NSInteger maxHours = 0; 82 | if ([info objectForKey:@"standby"]) { 83 | maxHours = [[info objectForKey:@"standby"] integerValue]; 84 | CGFloat totMinutes = (maxHours - ((100 - batteryLevel) * maxHours / 100)) * 60; //remaining time in minutes 85 | NSInteger hours = totMinutes / 60; //get hours 86 | NSInteger minutes = totMinutes - (hours * 60); // get minutes 87 | if (hours < 0 || minutes < 0) { 88 | return [NSString stringWithFormat:@"ND"]; 89 | } 90 | return [NSString stringWithFormat:@"%i:%02i",hours,minutes]; 91 | } else 92 | return @"NS"; 93 | } 94 | 95 | + (NSString *)remainingHoursFor3gConversation { 96 | CGFloat batteryLevel = [self batteryLevel]; 97 | NSDictionary *info = [self infoForDevice]; 98 | NSInteger maxHours = 0; 99 | if ([info objectForKey:@"standby"]) { 100 | maxHours = [[info objectForKey:@"conversation3g"] integerValue]; 101 | CGFloat totMinutes = (maxHours - ((100 - batteryLevel) * maxHours / 100)) * 60; //remaining time in minutes 102 | NSInteger hours = totMinutes / 60; //get hours 103 | NSInteger minutes = totMinutes - (hours * 60); // get minutes 104 | if (hours < 0 || minutes < 0) { 105 | return [NSString stringWithFormat:@"ND"]; 106 | } 107 | return [NSString stringWithFormat:@"%i:%02i",hours,minutes]; 108 | } else 109 | return @"NS"; 110 | } 111 | 112 | + (NSString *)remainingHoursFor2gConversation { 113 | CGFloat batteryLevel = [self batteryLevel]; 114 | NSDictionary *info = [self infoForDevice]; 115 | NSInteger maxHours = 0; 116 | if ([info objectForKey:@"standby"]) { 117 | maxHours = [[info objectForKey:@"conversation2g"] integerValue]; 118 | CGFloat totMinutes = (maxHours - ((100 - batteryLevel) * maxHours / 100)) * 60; //remaining time in minutes 119 | NSInteger hours = totMinutes / 60; //get hours 120 | NSInteger minutes = totMinutes - (hours * 60); // get minutes 121 | if (hours < 0 || minutes < 0) { 122 | return [NSString stringWithFormat:@"ND"]; 123 | } 124 | return [NSString stringWithFormat:@"%i:%02i",hours,minutes]; 125 | } else 126 | return @"NS"; 127 | } 128 | 129 | + (NSString *)remainingHoursForInternet3g { 130 | CGFloat batteryLevel = [self batteryLevel]; 131 | NSDictionary *info = [self infoForDevice]; 132 | NSInteger maxHours = 0; 133 | if ([info objectForKey:@"standby"]) { 134 | maxHours = [[info objectForKey:@"internet3g"] integerValue]; 135 | CGFloat totMinutes = (maxHours - ((100 - batteryLevel) * maxHours / 100)) * 60; //remaining time in minutes 136 | NSInteger hours = totMinutes / 60; //get hours 137 | NSInteger minutes = totMinutes - (hours * 60); // get minutes 138 | if (hours < 0 || minutes < 0) { 139 | return [NSString stringWithFormat:@"ND"]; 140 | } 141 | return [NSString stringWithFormat:@"%i:%02i",hours,minutes]; 142 | } else 143 | return @"NS"; 144 | } 145 | 146 | + (NSString *)remainingHoursForInternetWiFi { 147 | CGFloat batteryLevel = [self batteryLevel]; 148 | NSDictionary *info = [self infoForDevice]; 149 | NSInteger maxHours = 0; 150 | if ([info objectForKey:@"standby"]) { 151 | maxHours = [[info objectForKey:@"internetwifi"] integerValue]; 152 | CGFloat totMinutes = (maxHours - ((100 - batteryLevel) * maxHours / 100)) * 60; //remaining time in minutes 153 | NSInteger hours = totMinutes / 60; //get hours 154 | NSInteger minutes = totMinutes - (hours * 60); // get minutes 155 | if (hours < 0 || minutes < 0) { 156 | return [NSString stringWithFormat:@"ND"]; 157 | } 158 | return [NSString stringWithFormat:@"%i:%02i",hours,minutes]; 159 | } else 160 | return @"NS"; 161 | } 162 | 163 | + (NSString *)remainingHoursForVideo { 164 | CGFloat batteryLevel = [self batteryLevel]; 165 | NSDictionary *info = [self infoForDevice]; 166 | NSInteger maxHours = 0; 167 | if ([info objectForKey:@"standby"]) { 168 | maxHours = [[info objectForKey:@"video"] integerValue]; 169 | CGFloat totMinutes = (maxHours - ((100 - batteryLevel) * maxHours / 100)) * 60; //remaining time in minutes 170 | NSInteger hours = totMinutes / 60; // get hours 171 | NSInteger minutes = totMinutes - (hours *60); // get minutes 172 | if (hours < 0 || minutes < 0) { 173 | return [NSString stringWithFormat:@"ND"]; 174 | } 175 | return [NSString stringWithFormat:@"%i:%02i",hours,minutes]; 176 | } else 177 | return @"NS"; 178 | } 179 | 180 | + (NSString *)remainingHoursForAudio { 181 | CGFloat batteryLevel = [self batteryLevel]; 182 | NSDictionary *info = [self infoForDevice]; 183 | NSInteger maxHours = 0; 184 | if ([info objectForKey:@"standby"]) { 185 | maxHours = [[info objectForKey:@"audio"] integerValue]; 186 | CGFloat totMinutes = (maxHours - ((100 - batteryLevel) * maxHours / 100)) * 60; //remaining time in minutes 187 | NSInteger hours = totMinutes / 60; //get hours 188 | NSInteger minutes = totMinutes - (hours * 60); // get minutes 189 | if (hours < 0 || minutes < 0) { 190 | return [NSString stringWithFormat:@"ND"]; 191 | } 192 | return [NSString stringWithFormat:@"%i:%02i",hours,minutes]; 193 | } else 194 | return @"NS"; 195 | } 196 | 197 | @end 198 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/Reachability/Reachability.m: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | File: Reachability.m 4 | Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs. 5 | 6 | Version: 2.2 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. 9 | ("Apple") in consideration of your agreement to the following terms, and your 10 | use, installation, modification or redistribution of this Apple software 11 | constitutes acceptance of these terms. If you do not agree with these terms, 12 | please do not use, install, modify or redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and subject 15 | to these terms, Apple grants you a personal, non-exclusive license, under 16 | Apple's copyrights in this original Apple software (the "Apple Software"), to 17 | use, reproduce, modify and redistribute the Apple Software, with or without 18 | modifications, in source and/or binary forms; provided that if you redistribute 19 | the Apple Software in its entirety and without modifications, you must retain 20 | this notice and the following text and disclaimers in all such redistributions 21 | of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may be used 23 | to endorse or promote products derived from the Apple Software without specific 24 | prior written permission from Apple. Except as expressly stated in this notice, 25 | no other rights or licenses, express or implied, are granted by Apple herein, 26 | including but not limited to any patent rights that may be infringed by your 27 | derivative works or by other works in which the Apple Software may be 28 | incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO 31 | WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED 32 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 33 | PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN 34 | COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR 37 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39 | ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR 40 | DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF 41 | CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF 42 | APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2010 Apple Inc. All Rights Reserved. 45 | 46 | */ 47 | 48 | #import 49 | #import 50 | #import 51 | #import 52 | #import 53 | #import 54 | 55 | #import 56 | 57 | #import "Reachability.h" 58 | 59 | #define kShouldPrintReachabilityFlags 0 60 | 61 | static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment) 62 | { 63 | #if kShouldPrintReachabilityFlags 64 | 65 | NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n", 66 | (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-', 67 | (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-', 68 | 69 | (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-', 70 | (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-', 71 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-', 72 | (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-', 73 | (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-', 74 | (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-', 75 | (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-', 76 | comment 77 | ); 78 | #endif 79 | } 80 | 81 | 82 | @implementation Reachability 83 | static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info) 84 | { 85 | #pragma unused (target, flags) 86 | NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback"); 87 | NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback"); 88 | 89 | //We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively 90 | // in case someon uses the Reachablity object in a different thread. 91 | NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init]; 92 | 93 | Reachability* noteObject = (Reachability*) info; 94 | // Post a notification to notify the client that the network reachability changed. 95 | [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject]; 96 | 97 | [myPool release]; 98 | } 99 | 100 | - (BOOL) startNotifier 101 | { 102 | BOOL retVal = NO; 103 | SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL}; 104 | if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context)) 105 | { 106 | if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) 107 | { 108 | retVal = YES; 109 | } 110 | } 111 | return retVal; 112 | } 113 | 114 | - (void) stopNotifier 115 | { 116 | if(reachabilityRef!= NULL) 117 | { 118 | SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 119 | } 120 | } 121 | 122 | - (void) dealloc 123 | { 124 | [self stopNotifier]; 125 | if(reachabilityRef!= NULL) 126 | { 127 | CFRelease(reachabilityRef); 128 | } 129 | [super dealloc]; 130 | } 131 | 132 | + (Reachability*) reachabilityWithHostName: (NSString*) hostName; 133 | { 134 | Reachability* retVal = NULL; 135 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]); 136 | if(reachability!= NULL) 137 | { 138 | retVal= [[[self alloc] init] autorelease]; 139 | if(retVal!= NULL) 140 | { 141 | retVal->reachabilityRef = reachability; 142 | retVal->localWiFiRef = NO; 143 | } 144 | } 145 | return retVal; 146 | } 147 | 148 | + (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress; 149 | { 150 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress); 151 | Reachability* retVal = NULL; 152 | if(reachability!= NULL) 153 | { 154 | retVal= [[[self alloc] init] autorelease]; 155 | if(retVal!= NULL) 156 | { 157 | retVal->reachabilityRef = reachability; 158 | retVal->localWiFiRef = NO; 159 | } 160 | } 161 | return retVal; 162 | } 163 | 164 | + (Reachability*) reachabilityForInternetConnection; 165 | { 166 | struct sockaddr_in zeroAddress; 167 | bzero(&zeroAddress, sizeof(zeroAddress)); 168 | zeroAddress.sin_len = sizeof(zeroAddress); 169 | zeroAddress.sin_family = AF_INET; 170 | return [self reachabilityWithAddress: &zeroAddress]; 171 | } 172 | 173 | + (Reachability*) reachabilityForLocalWiFi; 174 | { 175 | struct sockaddr_in localWifiAddress; 176 | bzero(&localWifiAddress, sizeof(localWifiAddress)); 177 | localWifiAddress.sin_len = sizeof(localWifiAddress); 178 | localWifiAddress.sin_family = AF_INET; 179 | // IN_LINKLOCALNETNUM is defined in as 169.254.0.0 180 | localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM); 181 | Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress]; 182 | if(retVal!= NULL) 183 | { 184 | retVal->localWiFiRef = YES; 185 | } 186 | return retVal; 187 | } 188 | 189 | #pragma mark Network Flag Handling 190 | 191 | - (NetworkStatus) localWiFiStatusForFlags: (SCNetworkReachabilityFlags) flags 192 | { 193 | PrintReachabilityFlags(flags, "localWiFiStatusForFlags"); 194 | 195 | BOOL retVal = NotReachable; 196 | if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect)) 197 | { 198 | retVal = ReachableViaWiFi; 199 | } 200 | return retVal; 201 | } 202 | 203 | - (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags 204 | { 205 | PrintReachabilityFlags(flags, "networkStatusForFlags"); 206 | if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) 207 | { 208 | // if target host is not reachable 209 | return NotReachable; 210 | } 211 | 212 | BOOL retVal = NotReachable; 213 | 214 | if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) 215 | { 216 | // if target host is reachable and no connection is required 217 | // then we'll assume (for now) that your on Wi-Fi 218 | retVal = ReachableViaWiFi; 219 | } 220 | 221 | 222 | if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || 223 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)) 224 | { 225 | // ... and the connection is on-demand (or on-traffic) if the 226 | // calling application is using the CFSocketStream or higher APIs 227 | 228 | if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) 229 | { 230 | // ... and no [user] intervention is needed 231 | retVal = ReachableViaWiFi; 232 | } 233 | } 234 | 235 | if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN) 236 | { 237 | // ... but WWAN connections are OK if the calling application 238 | // is using the CFNetwork (CFSocketStream?) APIs. 239 | retVal = ReachableViaWWAN; 240 | } 241 | return retVal; 242 | } 243 | 244 | - (BOOL) connectionRequired; 245 | { 246 | NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef"); 247 | SCNetworkReachabilityFlags flags; 248 | if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) 249 | { 250 | return (flags & kSCNetworkReachabilityFlagsConnectionRequired); 251 | } 252 | return NO; 253 | } 254 | 255 | - (NetworkStatus) currentReachabilityStatus 256 | { 257 | NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef"); 258 | NetworkStatus retVal = NotReachable; 259 | SCNetworkReachabilityFlags flags; 260 | if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) 261 | { 262 | if(localWiFiRef) 263 | { 264 | retVal = [self localWiFiStatusForFlags: flags]; 265 | } 266 | else 267 | { 268 | retVal = [self networkStatusForFlags: flags]; 269 | } 270 | } 271 | return retVal; 272 | } 273 | @end 274 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALNetwork/ALNetwork.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALNetwork.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 21/07/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALNetwork.h" 10 | 11 | #define TEST_NUMBER 3 12 | //#define URL @"https://www.google.com/images/icons/product/chrome-48.png" //This file size is 2kb, so if the test is performed 8 times the total size will be 16kb, acceptable 13 | #define URL @"http://f.cl.ly/items/2j1N3k1u2h0D3R2o3k1h/Schermata_2013-09-04_alle_10.31.46.png" // This file size is 65kb 14 | //#define URL @"http://f.cl.ly/items/2M1F2W3G2s0s203R2U3T/2013-09-12%2017.58.06.jpg" // This file size is 2.4mb 15 | 16 | @interface ALNetwork () 17 | 18 | @property CGFloat dataLenght, downloadSpeed; 19 | @property NSTimeInterval timeIntervalAtStart, timeIntervalAtEnd, timeForDownload; 20 | @property NSURLConnection *urlConnection; 21 | @property BOOL requestStarted, requestFinished; 22 | @property NSInteger testCount; 23 | @property CGFloat sumOfDownloadSpeedForAverage; 24 | 25 | @end 26 | 27 | @implementation ALNetwork 28 | 29 | #pragma mark - Singleton methods 30 | 31 | + (ALNetwork *)sharedInstance { 32 | static ALNetwork *_shared; 33 | if(!_shared) { 34 | static dispatch_once_t oncePredicate; 35 | dispatch_once(&oncePredicate, ^ { 36 | _shared = [[super allocWithZone:nil] init]; 37 | }); 38 | } 39 | return _shared; 40 | } 41 | 42 | + (id)allocWithZone:(NSZone *)zone { return [self sharedInstance]; } 43 | - (id)copyWithZone:(NSZone *)zone { return self; } 44 | #if (!__has_feature(objc_arc)) 45 | - (id)retain { return self; } 46 | - (unsigned)retainCount { return UINT_MAX; } 47 | - (void)release { } 48 | - (id)autorelease { return self; } 49 | #endif 50 | 51 | #pragma mark - Class methods 52 | 53 | // This code is an answer to 54 | // this question : 55 | // http://stackoverflow.com/questions/7072989/iphone-ipad-how-to-get-my-ip-address-programmatically 56 | // by David H 57 | + (NSString *)currentIPAddress { 58 | struct ifaddrs *interfaces = NULL; 59 | struct ifaddrs *temp_addr = NULL; 60 | NSString *wifiAddress = nil; 61 | NSString *cellAddress = nil; 62 | 63 | // retrieve the current interfaces - returns 0 on success 64 | if(!getifaddrs(&interfaces)) { 65 | // Loop through linked list of interfaces 66 | temp_addr = interfaces; 67 | while(temp_addr != NULL) { 68 | sa_family_t sa_type = temp_addr->ifa_addr->sa_family; 69 | if(sa_type == AF_INET || sa_type == AF_INET6) { 70 | NSString *name = [NSString stringWithUTF8String:temp_addr->ifa_name]; 71 | NSString *addr = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)]; // pdp_ip0 72 | //NSLog(@"NAME: \"%@\" addr: %@", name, addr); // see for yourself 73 | 74 | if([name isEqualToString:@"en0"]) 75 | // Interface is the wifi connection on the iPhone 76 | wifiAddress = addr; 77 | else 78 | if([name isEqualToString:@"pdp_ip0"]) 79 | // Interface is the cell connection on the iPhone 80 | cellAddress = addr; 81 | 82 | } 83 | temp_addr = temp_addr->ifa_next; 84 | } 85 | // Free memory 86 | freeifaddrs(interfaces); 87 | } 88 | NSString *addr = wifiAddress ? wifiAddress : cellAddress; 89 | return addr ? addr : @"0.0.0.0"; 90 | } 91 | 92 | + (BOOL)connectedViaWiFi { 93 | Reachability *reachability = [Reachability reachabilityForInternetConnection]; 94 | [reachability startNotifier]; 95 | NetworkStatus status = [reachability currentReachabilityStatus]; 96 | if (status == ReachableViaWiFi) 97 | return YES; 98 | else 99 | return NO; 100 | } 101 | 102 | + (BOOL)connectedVia3G { 103 | Reachability *reachability = [Reachability reachabilityForInternetConnection]; 104 | [reachability startNotifier]; 105 | NetworkStatus status = [reachability currentReachabilityStatus]; 106 | if (status == ReachableViaWWAN) 107 | return YES; 108 | else 109 | return NO; 110 | } 111 | 112 | + (NSString *)macAddress { 113 | int mgmtInfoBase[6]; 114 | char *msgBuffer = NULL; 115 | size_t length; 116 | unsigned char macAddress[6]; 117 | struct if_msghdr *interfaceMsgStruct; 118 | struct sockaddr_dl *socketStruct; 119 | NSString *errorFlag = NULL; 120 | 121 | // Setup the management Information Base (mib) 122 | mgmtInfoBase[0] = CTL_NET; // Request network subsystem 123 | mgmtInfoBase[1] = AF_ROUTE; // Routing table info 124 | mgmtInfoBase[2] = 0; 125 | mgmtInfoBase[3] = AF_LINK; // Request link layer information 126 | mgmtInfoBase[4] = NET_RT_IFLIST; // Request all configured interfaces 127 | 128 | // With all configured interfaces requested, get handle index 129 | if ((mgmtInfoBase[5] = if_nametoindex("en0")) == 0) 130 | errorFlag = @"if_nametoindex failure"; 131 | else { 132 | // Get the size of the data available (store in len) 133 | if (sysctl(mgmtInfoBase, 6, NULL, &length, NULL, 0) < 0) 134 | errorFlag = @"sysctl mgmtInfoBase failure"; 135 | else { 136 | // Alloc memory based on above call 137 | if ((msgBuffer = malloc(length)) == NULL) 138 | errorFlag = @"buffer allocation failure"; 139 | else { 140 | // Get system information, store in buffer 141 | if (sysctl(mgmtInfoBase, 6, msgBuffer, &length, NULL, 0) < 0) 142 | errorFlag = @"sysctl msgBuffer failure"; 143 | } 144 | } 145 | } 146 | 147 | // Befor going any further... 148 | if (errorFlag != NULL) { 149 | NSLog(@"Error: %@", errorFlag); 150 | return errorFlag; 151 | } 152 | 153 | // Map msgbuffer to interface message structure 154 | interfaceMsgStruct = (struct if_msghdr *) msgBuffer; 155 | 156 | // Map to link-level socket structure 157 | socketStruct = (struct sockaddr_dl *) (interfaceMsgStruct + 1); 158 | 159 | // Copy link layer address data in socket structure to an array 160 | memcpy(&macAddress, socketStruct->sdl_data + socketStruct->sdl_nlen, 6); 161 | 162 | // Read from char array into a string object, into traditional Mac address format 163 | NSString *macAddressString = [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X", 164 | macAddress[0], macAddress[1], macAddress[2], 165 | macAddress[3], macAddress[4], macAddress[5]]; 166 | //NSLog(@"Mac Address: %@", macAddressString); 167 | 168 | // Release the buffer memory 169 | free(msgBuffer); 170 | 171 | return macAddressString; 172 | } 173 | 174 | // Credits to Shmoopi LLC, SystemServiceDemo 175 | // Get the External IP Address 176 | + (NSString *)externalIPAddress { 177 | // Check if we have an internet connection then try to get the External IP Address 178 | if (![self connectedViaWiFi] && ![self connectedVia3G]) { 179 | // Not connected to anything, return nil 180 | return nil; 181 | } 182 | 183 | // Get the external IP Address based on dynsns.org 184 | NSError *error = nil; 185 | NSString *theIpHtml = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.dyndns.org/cgi-bin/check_ip.cgi"] 186 | encoding:NSUTF8StringEncoding 187 | error:&error]; 188 | if (!error) { 189 | NSUInteger an_Integer; 190 | NSArray *ipItemsArray; 191 | NSString *externalIP; 192 | NSScanner *theScanner; 193 | NSString *text = nil; 194 | 195 | theScanner = [NSScanner scannerWithString:theIpHtml]; 196 | 197 | while ([theScanner isAtEnd] == NO) { 198 | 199 | // find start of tag 200 | [theScanner scanUpToString:@"<" intoString:NULL] ; 201 | 202 | // find end of tag 203 | [theScanner scanUpToString:@">" intoString:&text] ; 204 | 205 | // replace the found tag with a space 206 | //(you can filter multi-spaces out later if you wish) 207 | theIpHtml = [theIpHtml stringByReplacingOccurrencesOfString: 208 | [ NSString stringWithFormat:@"%@>", text] 209 | withString:@" "] ; 210 | ipItemsArray = [theIpHtml componentsSeparatedByString:@" "]; 211 | an_Integer = [ipItemsArray indexOfObject:@"Address:"]; 212 | externalIP =[ipItemsArray objectAtIndex:++an_Integer]; 213 | } 214 | // Check that you get something back 215 | if (externalIP == nil || externalIP.length <= 0) { 216 | // Error, no address found 217 | return nil; 218 | } 219 | // Return External IP 220 | return externalIP; 221 | } else { 222 | // Error, no address found 223 | return nil; 224 | } 225 | } 226 | 227 | // Credits to Shmoopi LLC, SystemServiceDemo 228 | // Get the cell IP address 229 | + (NSString *)cellIPAddress { 230 | // Set a string for the address 231 | NSString *IPAddress; 232 | // Set up structs to hold the interfaces and the temporary address 233 | struct ifaddrs *Interfaces; 234 | struct ifaddrs *Temp; 235 | struct sockaddr_in *s4; 236 | char buf[64]; 237 | 238 | // If it's 0, then it's good 239 | if (!getifaddrs(&Interfaces)) 240 | { 241 | // Loop through the list of interfaces 242 | Temp = Interfaces; 243 | 244 | // Run through it while it's still available 245 | while(Temp != NULL) 246 | { 247 | // If the temp interface is a valid interface 248 | if(Temp->ifa_addr->sa_family == AF_INET) 249 | { 250 | // Check if the interface is Cell 251 | if([[NSString stringWithUTF8String:Temp->ifa_name] isEqualToString:@"pdp_ip0"]) 252 | { 253 | s4 = (struct sockaddr_in *)Temp->ifa_addr; 254 | 255 | if (inet_ntop(Temp->ifa_addr->sa_family, (void *)&(s4->sin_addr), buf, sizeof(buf)) == NULL) { 256 | // Failed to find it 257 | IPAddress = nil; 258 | } else { 259 | // Got the Cell IP Address 260 | IPAddress = [NSString stringWithUTF8String:buf]; 261 | } 262 | } 263 | } 264 | 265 | // Set the temp value to the next interface 266 | Temp = Temp->ifa_next; 267 | } 268 | } 269 | 270 | // Free the memory of the interfaces 271 | freeifaddrs(Interfaces); 272 | 273 | // Check to make sure it's not empty 274 | if (IPAddress == nil || IPAddress.length <= 0) { 275 | // Empty, return not found 276 | return nil; 277 | } 278 | 279 | // Return the IP Address of the WiFi 280 | return IPAddress; 281 | } 282 | 283 | + (NSString *)WiFiNetmaskAddress { 284 | // Set up the variable 285 | struct ifreq afr; 286 | // Copy the string 287 | strncpy(afr.ifr_name, [@"en0" UTF8String], IFNAMSIZ-1); 288 | // Open a socket 289 | int afd = socket(AF_INET, SOCK_DGRAM, 0); 290 | 291 | // Check the socket 292 | if (afd == -1) { 293 | // Error, socket failed to open 294 | return nil; 295 | } 296 | 297 | // Check the netmask output 298 | if (ioctl(afd, SIOCGIFNETMASK, &afr) == -1) { 299 | // Error, netmask wasn't found 300 | // Close the socket 301 | close(afd); 302 | // Return error 303 | return nil; 304 | } 305 | 306 | // Close the socket 307 | close(afd); 308 | 309 | // Create a char for the netmask 310 | char *netstring = inet_ntoa(((struct sockaddr_in *)&afr.ifr_addr)->sin_addr); 311 | 312 | // Create a string for the netmask 313 | NSString *Netmask = [NSString stringWithUTF8String:netstring]; 314 | 315 | // Check to make sure it's not nil 316 | if (Netmask == nil || Netmask.length <= 0) { 317 | // Error, netmask not found 318 | return nil; 319 | } 320 | 321 | // Return successful 322 | return Netmask; 323 | } 324 | 325 | + (NSString *)WiFiBroadcastAddress { 326 | // Set up strings for the IP and Netmask 327 | NSString *IPAddress = [self currentIPAddress]; 328 | NSString *NMAddress = [self WiFiNetmaskAddress]; 329 | 330 | // Check to make sure they aren't nil 331 | if (IPAddress == nil || IPAddress.length <= 0) { 332 | // Error, IP Address can't be nil 333 | return nil; 334 | } 335 | if (NMAddress == nil || NMAddress.length <= 0) { 336 | // Error, NM Address can't be nil 337 | return nil; 338 | } 339 | 340 | // Check the formatting of the IP and NM Addresses 341 | NSArray *IPCheck = [IPAddress componentsSeparatedByString:@"."]; 342 | NSArray *NMCheck = [NMAddress componentsSeparatedByString:@"."]; 343 | 344 | // Make sure the IP and NM Addresses are correct 345 | if (IPCheck.count != 4 || NMCheck.count != 4) { 346 | // Incorrect IP Addresses 347 | return nil; 348 | } 349 | 350 | // Set up the variables 351 | NSUInteger IP = 0; 352 | NSUInteger NM = 0; 353 | NSUInteger CS = 24; 354 | 355 | // Make the address based on the other addresses 356 | for (NSUInteger i = 0; i < 4; i++, CS -= 8) { 357 | IP |= [[IPCheck objectAtIndex:i] intValue] << CS; 358 | NM |= [[NMCheck objectAtIndex:i] intValue] << CS; 359 | } 360 | 361 | // Set it equal to the formatted raw addresses 362 | NSUInteger BA = ~NM | IP; 363 | 364 | // Make a string for the address 365 | NSString *BroadcastAddress = [NSString stringWithFormat:@"%d.%d.%d.%d", (BA & 0xFF000000) >> 24, 366 | (BA & 0x00FF0000) >> 16, (BA & 0x0000FF00) >> 8, BA & 0x000000FF]; 367 | 368 | // Check to make sure the string is valid 369 | if (BroadcastAddress == nil || BroadcastAddress.length <= 0) { 370 | // Error, no address 371 | return nil; 372 | } 373 | 374 | // Return Successful 375 | return BroadcastAddress; 376 | } 377 | 378 | // FIXME: The download speed methods don't work correctly. 379 | // Da rivedere questi metodi sulla velocità di download. 380 | // Non funzionano correttamente, sopratutto su iOS 7. 381 | #pragma mark - Instance methods 382 | 383 | - (void)downloadSpeedInKbPerSec { 384 | if (!self.requestStarted) 385 | [self startConnectionSpeedTest]; 386 | } 387 | 388 | - (void)startConnectionSpeedTest { 389 | self.requestStarted = YES; 390 | self.requestFinished = NO; 391 | NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:URL]]; 392 | NSURLConnection *urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; 393 | [urlConnection start]; 394 | self.timeIntervalAtStart = [NSDate timeIntervalSinceReferenceDate]; 395 | } 396 | 397 | #pragma mark - NSURLConnection delegate 398 | 399 | - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { 400 | self.dataLenght += [data length]; 401 | self.requestFinished = NO; 402 | } 403 | 404 | - (void)connectionDidFinishLoading:(NSURLConnection *)connection { 405 | self.timeIntervalAtEnd = [NSDate timeIntervalSinceReferenceDate]; 406 | self.timeForDownload = self.timeIntervalAtEnd - self.timeIntervalAtStart; 407 | NSLog(@":: %f ::",self.dataLenght); 408 | self.downloadSpeed = (self.dataLenght / self.timeForDownload) / 1024; //in Kb/s 409 | self.sumOfDownloadSpeedForAverage += self.downloadSpeed; 410 | self.requestFinished = YES; 411 | self.requestStarted = NO; 412 | if (self.testCount == TEST_NUMBER) { 413 | CGFloat avgDownloadSpeed = self.sumOfDownloadSpeedForAverage / TEST_NUMBER; 414 | [self.delegate downloadSpeedTestFinished:[NSString stringWithFormat:@"%.2f Kb/s",avgDownloadSpeed]]; 415 | } else { 416 | NSLog(@"[ALNetwork] DOWNLOAD SPEED = %f",self.downloadSpeed); 417 | self.dataLenght = 0.0f; 418 | self.timeForDownload = 0.0f; 419 | self.timeIntervalAtStart = 0.0; 420 | self.timeIntervalAtEnd = 0.0; 421 | [self downloadSpeedInKbPerSec]; 422 | self.testCount++; 423 | } 424 | } 425 | 426 | @end 427 | -------------------------------------------------------------------------------- /ALSystemUtilities/ALSystemUtilities/ALSystem/ALSystem.m: -------------------------------------------------------------------------------- 1 | // 2 | // ALSystem.m 3 | // ALSystem 4 | // 5 | // Created by Andrea Mario Lufino on 09/09/13. 6 | // Copyright (c) 2013 Andrea Mario Lufino. All rights reserved. 7 | // 8 | 9 | #import "ALSystem.h" 10 | 11 | @implementation ALSystem 12 | 13 | #pragma mark - All info 14 | 15 | + (NSDictionary *)systemInformations { 16 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 17 | // Battery 18 | [dictionary setObject:[NSNumber numberWithBool:[ALBattery batteryFullCharged]] forKey:ALBattery_batteryFullCharged]; 19 | [dictionary setObject:[NSNumber numberWithBool:[ALBattery inCharge]] forKey:ALBattery_inCharge]; 20 | [dictionary setObject:[NSNumber numberWithBool:[ALBattery devicePluggedIntoPower]] forKey:ALBattery_devicePluggedIntoPower]; 21 | [dictionary setObject:[NSNumber numberWithInt:[ALBattery batteryState]] forKey:ALBattery_batteryState]; 22 | [dictionary setObject:[NSNumber numberWithFloat:[ALBattery batteryLevel]] forKey:ALBattery_batteryLevel]; 23 | [dictionary setObject:[ALBattery remainingHoursForStandby] forKey:ALBattery_remainingHoursForStandby]; 24 | [dictionary setObject:[ALBattery remainingHoursFor3gConversation] forKey:ALBattery_remainingHoursFor3gConversation]; 25 | [dictionary setObject:[ALBattery remainingHoursFor2gConversation] forKey:ALBattery_remainingHoursFor2gConversation]; 26 | [dictionary setObject:[ALBattery remainingHoursForInternet3g] forKey:ALBattery_remainingHoursForInternet3g]; 27 | [dictionary setObject:[ALBattery remainingHoursForInternetWiFi] forKey:ALBattery_remainingHoursForInternetWiFi]; 28 | [dictionary setObject:[ALBattery remainingHoursForVideo] forKey:ALBattery_remainingHoursForVideo]; 29 | [dictionary setObject:[ALBattery remainingHoursForAudio] forKey:ALBattery_remainingHoursForAudio]; 30 | // Disk 31 | [dictionary setObject:[ALDisk totalDiskSpace] forKey:ALDisk_totalDiskSpace]; 32 | [dictionary setObject:[ALDisk freeDiskSpace] forKey:ALDisk_freeDiskSpace]; 33 | [dictionary setObject:[ALDisk usedDiskSpace] forKey:ALDisk_usedDiskSpace]; 34 | [dictionary setObject:[NSNumber numberWithFloat:[ALDisk totalDiskSpaceInBytes]] forKey:ALDisk_totalDiskSpaceInBytes]; 35 | [dictionary setObject:[NSNumber numberWithFloat:[ALDisk freeDiskSpaceInBytes]] forKey:ALDisk_freeDiskSpaceInBytes]; 36 | [dictionary setObject:[NSNumber numberWithFloat:[ALDisk usedDiskSpaceInBytes]] forKey:ALDisk_usedDiskSpaceInBytes]; 37 | // Hardware 38 | [dictionary setObject:[ALHardware deviceModel] forKey:ALHardware_deviceModel]; 39 | [dictionary setObject:[ALHardware deviceName] forKey:ALHardware_deviceName]; 40 | [dictionary setObject:[ALHardware systemName] forKey:ALHardware_systemName]; 41 | [dictionary setObject:[ALHardware systemVersion] forKey:ALHardware_systemVersion]; 42 | [dictionary setObject:[NSNumber numberWithFloat:[ALHardware screenWidth]] forKey:ALHardware_screenWidth]; 43 | [dictionary setObject:[NSNumber numberWithFloat:[ALHardware screenHeight]] forKey:ALHardware_screenHeight]; 44 | [dictionary setObject:[NSNumber numberWithFloat:[ALHardware brightness]] forKey:ALHardware_brightness]; 45 | [dictionary setObject:[ALHardware platformType] forKey:ALHardware_platformType]; 46 | [dictionary setObject:[ALHardware bootTime] forKey:ALHardware_bootTime]; 47 | [dictionary setObject:[NSNumber numberWithBool:[ALHardware proximitySensor]] forKey:ALHardware_proximitySensor]; 48 | [dictionary setObject:[NSNumber numberWithBool:[ALHardware multitaskingEnabled]] forKey:ALHardware_multitaskingEnabled]; 49 | [dictionary setObject:[ALHardware sim] forKey:ALHardware_sim]; 50 | [dictionary setObject:[ALHardware dimensions] forKey:ALHardware_dimensions]; 51 | [dictionary setObject:[ALHardware weight] forKey:ALHardware_weight]; 52 | [dictionary setObject:[ALHardware displayType] forKey:ALHardware_displayType]; 53 | [dictionary setObject:[ALHardware displayDensity] forKey:ALHardware_displayDensity]; 54 | [dictionary setObject:[ALHardware WLAN] forKey:ALHardware_WLAN]; 55 | [dictionary setObject:[ALHardware bluetooth] forKey:ALHardware_bluetooth]; 56 | [dictionary setObject:[ALHardware cameraPrimary] forKey:ALHardware_cameraPrimary]; 57 | [dictionary setObject:[ALHardware cameraSecondary] forKey:ALHardware_cameraSecondary]; 58 | [dictionary setObject:[ALHardware cpu] forKey:ALHardware_cpu]; 59 | [dictionary setObject:[ALHardware gpu] forKey:ALHardware_gpu]; 60 | // Jailbreak 61 | [dictionary setObject:[NSNumber numberWithBool:[ALJailbreak isJailbroken]] forKey:ALJailbreak_isJailbroken]; 62 | // Localization 63 | [dictionary setObject:[ALLocalization language] forKey:ALLocalization_language]; 64 | [dictionary setObject:[ALLocalization timeZone] forKey:ALLocalization_timeZone]; 65 | [dictionary setObject:[ALLocalization currencySymbol] forKey:ALLocalization_currencySimbol]; 66 | [dictionary setObject:[ALLocalization currencyCode] forKey:ALLocalization_currencyCode]; 67 | [dictionary setObject:[ALLocalization country] forKey:ALLocalization_country]; 68 | [dictionary setObject:[ALLocalization measurementSystem] forKey:ALLocalization_measurementSystem]; 69 | // Memory 70 | [dictionary setObject:[NSNumber numberWithInteger:[ALMemory totalMemory]] forKey:ALMemory_totalMemory]; 71 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory freeMemory]] forKey:ALMemory_freeMemory]; 72 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory usedMemory]] forKey:ALMemory_usedMemory]; 73 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory activeMemory]] forKey:ALMemory_activeMemory]; 74 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory wiredMemory]] forKey:ALMemory_wiredMemory]; 75 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory inactiveMemory]] forKey:ALMemory_inactivemMemory]; 76 | // Network 77 | [dictionary setObject:[ALNetwork currentIPAddress] forKey:ALNetwork_currentIPAddress]; 78 | [dictionary setObject:[NSNumber numberWithBool:[ALNetwork connectedViaWiFi]] forKey:ALNetwork_connectedViaWiFi]; 79 | [dictionary setObject:[NSNumber numberWithBool:[ALNetwork connectedVia3G]] forKey:ALNetwork_connectedVia3G]; 80 | [dictionary setObject:[ALNetwork macAddress] forKey:ALNetwork_macAddress]; 81 | [dictionary setObject:[ALNetwork externalIPAddress] forKey:ALNetwork_externalIPAddress]; 82 | [dictionary setObject:[ALNetwork cellIPAddress] forKey:ALNetwork_cellIPAddress]; 83 | [dictionary setObject:[ALNetwork WiFiNetmaskAddress] forKey:ALNetwork_WiFiNetmaskAddress]; 84 | [dictionary setObject:[ALNetwork WiFiBroadcastAddress] forKey:ALNetwork_WiFiBroadcastAddress]; 85 | // Processor 86 | [dictionary setObject:[NSNumber numberWithInteger:[ALProcessor processorsNumber]] forKey:ALProcessor_processorsNumber]; 87 | [dictionary setObject:[NSNumber numberWithInteger:[ALProcessor activeProcessorsNumber]] forKey:ALProcessor_activeProcessorsNumber]; 88 | [dictionary setObject:[NSNumber numberWithFloat:[ALProcessor cpuUsageForApp]] forKey:ALProcessor_cpuUsageForApp]; 89 | [dictionary setObject:[ALProcessor activeProcesses] forKey:ALProcessor_activeProcesses]; 90 | [dictionary setObject:[NSNumber numberWithInteger:[ALProcessor numberOfActiveProcesses]] forKey:ALProcessor_numberOfActiveProcesses]; 91 | // Carrier 92 | [dictionary setObject:[ALCarrier carrierName] forKey:ALCarrier_carrierName]; 93 | [dictionary setObject:[ALCarrier carrierISOCountryCode] forKey:ALCarrier_carrierISOCountryCode]; 94 | [dictionary setObject:[ALCarrier carrierMobileCountryCode] forKey:ALCarrier_carrierMobileCountryCode]; 95 | [dictionary setObject:[ALCarrier carrierMobileNetworkCode] forKey:ALCarrier_carriermobileNetworkCode]; 96 | [dictionary setObject:[NSNumber numberWithBool:[ALCarrier carrierAllowsVOIP]] forKey:ALCarrier_carrierAllowsVOIP]; 97 | // Accessory 98 | [dictionary setObject:[NSNumber numberWithBool:[ALAccessory accessoriesPluggedIn]] forKey:ALAccessory_accessoriesPluggedIn]; 99 | [dictionary setObject:[NSNumber numberWithInteger:[ALAccessory numberOfAccessoriesPluggedIn]] forKey:ALAccessory_numberOfAccessoriesPluggedIn]; 100 | [dictionary setObject:[NSNumber numberWithBool:[ALAccessory isHeadphonesAttached]] forKey:ALAccessory_isHeadphonesAttached]; 101 | return dictionary; 102 | } 103 | 104 | #pragma mark - Battery 105 | 106 | + (NSDictionary *)batteryInformations { 107 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 108 | [dictionary setObject:[NSNumber numberWithBool:[ALBattery batteryFullCharged]] forKey:ALBattery_batteryFullCharged]; 109 | [dictionary setObject:[NSNumber numberWithBool:[ALBattery inCharge]] forKey:ALBattery_inCharge]; 110 | [dictionary setObject:[NSNumber numberWithBool:[ALBattery devicePluggedIntoPower]] forKey:ALBattery_devicePluggedIntoPower]; 111 | [dictionary setObject:[NSNumber numberWithInt:[ALBattery batteryState]] forKey:ALBattery_batteryState]; 112 | [dictionary setObject:[NSNumber numberWithFloat:[ALBattery batteryLevel]] forKey:ALBattery_batteryLevel]; 113 | [dictionary setObject:[ALBattery remainingHoursForStandby] forKey:ALBattery_remainingHoursForStandby]; 114 | [dictionary setObject:[ALBattery remainingHoursFor3gConversation] forKey:ALBattery_remainingHoursFor3gConversation]; 115 | [dictionary setObject:[ALBattery remainingHoursFor2gConversation] forKey:ALBattery_remainingHoursFor2gConversation]; 116 | [dictionary setObject:[ALBattery remainingHoursForInternet3g] forKey:ALBattery_remainingHoursForInternet3g]; 117 | [dictionary setObject:[ALBattery remainingHoursForInternetWiFi] forKey:ALBattery_remainingHoursForInternetWiFi]; 118 | [dictionary setObject:[ALBattery remainingHoursForVideo] forKey:ALBattery_remainingHoursForVideo]; 119 | [dictionary setObject:[ALBattery remainingHoursForAudio] forKey:ALBattery_remainingHoursForAudio]; 120 | return dictionary; 121 | } 122 | 123 | #pragma mark - Disk 124 | 125 | + (NSDictionary *)diskInformations { 126 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 127 | [dictionary setObject:[ALDisk totalDiskSpace] forKey:ALDisk_totalDiskSpace]; 128 | [dictionary setObject:[ALDisk freeDiskSpace] forKey:ALDisk_freeDiskSpace]; 129 | [dictionary setObject:[ALDisk usedDiskSpace] forKey:ALDisk_usedDiskSpace]; 130 | [dictionary setObject:[NSNumber numberWithFloat:[ALDisk totalDiskSpaceInBytes]] forKey:ALDisk_totalDiskSpaceInBytes]; 131 | [dictionary setObject:[NSNumber numberWithFloat:[ALDisk freeDiskSpaceInBytes]] forKey:ALDisk_freeDiskSpaceInBytes]; 132 | [dictionary setObject:[NSNumber numberWithFloat:[ALDisk usedDiskSpaceInBytes]] forKey:ALDisk_usedDiskSpaceInBytes]; 133 | return dictionary; 134 | } 135 | 136 | #pragma mark - Hardware 137 | 138 | + (NSDictionary *)hardwareInformations { 139 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 140 | [dictionary setObject:[ALHardware deviceModel] forKey:ALHardware_deviceModel]; 141 | [dictionary setObject:[ALHardware deviceName] forKey:ALHardware_deviceName]; 142 | [dictionary setObject:[ALHardware systemName] forKey:ALHardware_systemName]; 143 | [dictionary setObject:[ALHardware systemVersion] forKey:ALHardware_systemVersion]; 144 | [dictionary setObject:[NSNumber numberWithFloat:[ALHardware screenWidth]] forKey:ALHardware_screenWidth]; 145 | [dictionary setObject:[NSNumber numberWithFloat:[ALHardware screenHeight]] forKey:ALHardware_screenHeight]; 146 | [dictionary setObject:[NSNumber numberWithFloat:[ALHardware brightness]] forKey:ALHardware_brightness]; 147 | [dictionary setObject:[ALHardware platformType] forKey:ALHardware_platformType]; 148 | [dictionary setObject:[ALHardware bootTime] forKey:ALHardware_bootTime]; 149 | [dictionary setObject:[NSNumber numberWithBool:[ALHardware proximitySensor]] forKey:ALHardware_proximitySensor]; 150 | [dictionary setObject:[NSNumber numberWithBool:[ALHardware multitaskingEnabled]] forKey:ALHardware_multitaskingEnabled]; 151 | [dictionary setObject:[ALHardware sim] forKey:ALHardware_sim]; 152 | [dictionary setObject:[ALHardware dimensions] forKey:ALHardware_dimensions]; 153 | [dictionary setObject:[ALHardware weight] forKey:ALHardware_weight]; 154 | [dictionary setObject:[ALHardware displayType] forKey:ALHardware_displayType]; 155 | [dictionary setObject:[ALHardware displayDensity] forKey:ALHardware_displayDensity]; 156 | [dictionary setObject:[ALHardware WLAN] forKey:ALHardware_WLAN]; 157 | [dictionary setObject:[ALHardware bluetooth] forKey:ALHardware_bluetooth]; 158 | [dictionary setObject:[ALHardware cameraPrimary] forKey:ALHardware_cameraPrimary]; 159 | [dictionary setObject:[ALHardware cameraSecondary] forKey:ALHardware_cameraSecondary]; 160 | [dictionary setObject:[ALHardware cpu] forKey:ALHardware_cpu]; 161 | [dictionary setObject:[ALHardware gpu] forKey:ALHardware_gpu]; 162 | return dictionary; 163 | } 164 | 165 | #pragma mark - Jailbreak 166 | 167 | + (NSDictionary *)jailbreakInformations { 168 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 169 | [dictionary setObject:[NSNumber numberWithBool:[ALJailbreak isJailbroken]] forKey:ALJailbreak_isJailbroken]; 170 | return dictionary; 171 | } 172 | 173 | #pragma mark - Localization 174 | 175 | + (NSDictionary *)localizationInformations { 176 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 177 | [dictionary setObject:[ALLocalization language] forKey:ALLocalization_language]; 178 | [dictionary setObject:[ALLocalization timeZone] forKey:ALLocalization_timeZone]; 179 | [dictionary setObject:[ALLocalization currencySymbol] forKey:ALLocalization_currencySimbol]; 180 | [dictionary setObject:[ALLocalization currencyCode] forKey:ALLocalization_currencyCode]; 181 | [dictionary setObject:[ALLocalization country] forKey:ALLocalization_country]; 182 | [dictionary setObject:[ALLocalization measurementSystem] forKey:ALLocalization_measurementSystem]; 183 | return dictionary; 184 | } 185 | 186 | #pragma mark - Memory 187 | 188 | + (NSDictionary *)memoryInformations { 189 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 190 | [dictionary setObject:[NSNumber numberWithInteger:[ALMemory totalMemory]] forKey:ALMemory_totalMemory]; 191 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory freeMemory]] forKey:ALMemory_freeMemory]; 192 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory usedMemory]] forKey:ALMemory_usedMemory]; 193 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory activeMemory]] forKey:ALMemory_activeMemory]; 194 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory wiredMemory]] forKey:ALMemory_wiredMemory]; 195 | [dictionary setObject:[NSNumber numberWithFloat:[ALMemory inactiveMemory]] forKey:ALMemory_inactivemMemory]; 196 | return dictionary; 197 | } 198 | 199 | #pragma mark - Network 200 | 201 | + (NSDictionary *)networkInformations { 202 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 203 | [dictionary setObject:[ALNetwork currentIPAddress] forKey:ALNetwork_currentIPAddress]; 204 | [dictionary setObject:[NSNumber numberWithBool:[ALNetwork connectedViaWiFi]] forKey:ALNetwork_connectedViaWiFi]; 205 | [dictionary setObject:[NSNumber numberWithBool:[ALNetwork connectedVia3G]] forKey:ALNetwork_connectedVia3G]; 206 | [dictionary setObject:[ALNetwork macAddress] forKey:ALNetwork_macAddress]; 207 | [dictionary setObject:[ALNetwork externalIPAddress] forKey:ALNetwork_externalIPAddress]; 208 | [dictionary setObject:[ALNetwork cellIPAddress] forKey:ALNetwork_cellIPAddress]; 209 | [dictionary setObject:[ALNetwork WiFiNetmaskAddress] forKey:ALNetwork_WiFiNetmaskAddress]; 210 | [dictionary setObject:[ALNetwork WiFiBroadcastAddress] forKey:ALNetwork_WiFiBroadcastAddress]; 211 | return dictionary; 212 | } 213 | 214 | #pragma mark - Processor 215 | 216 | + (NSDictionary *)processorInformations { 217 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 218 | [dictionary setObject:[NSNumber numberWithInteger:[ALProcessor processorsNumber]] forKey:ALProcessor_processorsNumber]; 219 | [dictionary setObject:[NSNumber numberWithInteger:[ALProcessor activeProcessorsNumber]] forKey:ALProcessor_activeProcessorsNumber]; 220 | [dictionary setObject:[NSNumber numberWithFloat:[ALProcessor cpuUsageForApp]] forKey:ALProcessor_cpuUsageForApp]; 221 | [dictionary setObject:[ALProcessor activeProcesses] forKey:ALProcessor_activeProcesses]; 222 | [dictionary setObject:[NSNumber numberWithInteger:[ALProcessor numberOfActiveProcesses]] forKey:ALProcessor_numberOfActiveProcesses]; 223 | return dictionary; 224 | } 225 | 226 | #pragma mark - Carrier 227 | 228 | + (NSDictionary *)carrierInformations { 229 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 230 | [dictionary setObject:[ALCarrier carrierName] forKey:ALCarrier_carrierName]; 231 | [dictionary setObject:[ALCarrier carrierISOCountryCode] forKey:ALCarrier_carrierISOCountryCode]; 232 | [dictionary setObject:[ALCarrier carrierMobileCountryCode] forKey:ALCarrier_carrierMobileCountryCode]; 233 | [dictionary setObject:[ALCarrier carrierMobileNetworkCode] forKey:ALCarrier_carriermobileNetworkCode]; 234 | [dictionary setObject:[NSNumber numberWithBool:[ALCarrier carrierAllowsVOIP]] forKey:ALCarrier_carrierAllowsVOIP]; 235 | return dictionary; 236 | } 237 | 238 | #pragma mark - Accessory 239 | 240 | + (NSDictionary *)accessoryInformations { 241 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 242 | [dictionary setObject:[NSNumber numberWithBool:[ALAccessory accessoriesPluggedIn]] forKey:ALAccessory_accessoriesPluggedIn]; 243 | [dictionary setObject:[NSNumber numberWithInteger:[ALAccessory numberOfAccessoriesPluggedIn]] forKey:ALAccessory_numberOfAccessoriesPluggedIn]; 244 | [dictionary setObject:[NSNumber numberWithBool:[ALAccessory isHeadphonesAttached]] forKey:ALAccessory_isHeadphonesAttached]; 245 | return dictionary; 246 | } 247 | 248 | @end 249 | -------------------------------------------------------------------------------- /ALSystemUtilities.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0449A8C0183A019800970366 /* ALSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 0449A8BE183A019800970366 /* ALSystem.h */; }; 11 | 0449A8C1183A019800970366 /* ALSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 0449A8BF183A019800970366 /* ALSystem.m */; }; 12 | 0449A8C3183A01CA00970366 /* 3RPartyHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0449A8C2183A01C800970366 /* 3RPartyHelper.h */; }; 13 | 8710CCA218227461009590EE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8710CC9C18227461009590EE /* AudioToolbox.framework */; }; 14 | 8710CCA318227461009590EE /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8710CC9D18227461009590EE /* CFNetwork.framework */; }; 15 | 8710CCA418227461009590EE /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8710CC9E18227461009590EE /* CoreTelephony.framework */; }; 16 | 8710CCA518227461009590EE /* ExternalAccessory.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8710CC9F18227461009590EE /* ExternalAccessory.framework */; }; 17 | 8710CCA618227461009590EE /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8710CCA018227461009590EE /* Security.framework */; }; 18 | 8710CCA718227461009590EE /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8710CCA118227461009590EE /* SystemConfiguration.framework */; }; 19 | 87D8E4AB182156D300546E6D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4A9182156D300546E6D /* InfoPlist.strings */; }; 20 | 87D8E4B8182156FB00546E6D /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87D8E4B6182156FB00546E6D /* CoreFoundation.framework */; }; 21 | 87D8E4B9182156FB00546E6D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87D8E4B7182156FB00546E6D /* Foundation.framework */; }; 22 | 87D8E4BB1821570000546E6D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87D8E4BA1821570000546E6D /* CoreGraphics.framework */; }; 23 | 87D8E4BD1821570500546E6D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87D8E4BC1821570500546E6D /* UIKit.framework */; }; 24 | 87D8E4FA1821577E00546E6D /* ALAccessory.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4C01821577E00546E6D /* ALAccessory.h */; settings = {ATTRIBUTES = (Public, ); }; }; 25 | 87D8E4FB1821577E00546E6D /* ALAccessory.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4C11821577E00546E6D /* ALAccessory.m */; }; 26 | 87D8E4FC1821577E00546E6D /* ALBattery.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4C31821577E00546E6D /* ALBattery.h */; settings = {ATTRIBUTES = (Public, ); }; }; 27 | 87D8E4FD1821577E00546E6D /* ALBattery.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4C41821577E00546E6D /* ALBattery.m */; }; 28 | 87D8E4FE1821577E00546E6D /* ALCarrier.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4C61821577E00546E6D /* ALCarrier.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29 | 87D8E4FF1821577E00546E6D /* ALCarrier.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4C71821577E00546E6D /* ALCarrier.m */; }; 30 | 87D8E5001821577E00546E6D /* ALDisk.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4C91821577E00546E6D /* ALDisk.h */; settings = {ATTRIBUTES = (Public, ); }; }; 31 | 87D8E5011821577E00546E6D /* ALDisk.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4CA1821577E00546E6D /* ALDisk.m */; }; 32 | 87D8E5021821577E00546E6D /* ALHardware.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4CC1821577E00546E6D /* ALHardware.h */; settings = {ATTRIBUTES = (Public, ); }; }; 33 | 87D8E5031821577E00546E6D /* ALHardware.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4CD1821577E00546E6D /* ALHardware.m */; }; 34 | 87D8E5041821577E00546E6D /* ALJailbreak.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4CF1821577E00546E6D /* ALJailbreak.h */; settings = {ATTRIBUTES = (Public, ); }; }; 35 | 87D8E5051821577E00546E6D /* ALJailbreak.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4D01821577E00546E6D /* ALJailbreak.m */; }; 36 | 87D8E5061821577E00546E6D /* ALLocalization.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4D21821577E00546E6D /* ALLocalization.h */; settings = {ATTRIBUTES = (Public, ); }; }; 37 | 87D8E5071821577E00546E6D /* ALLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4D31821577E00546E6D /* ALLocalization.m */; }; 38 | 87D8E5081821577E00546E6D /* ALMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4D51821577E00546E6D /* ALMemory.h */; settings = {ATTRIBUTES = (Public, ); }; }; 39 | 87D8E5091821577E00546E6D /* ALMemory.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4D61821577E00546E6D /* ALMemory.m */; }; 40 | 87D8E50A1821577E00546E6D /* ALNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4D81821577E00546E6D /* ALNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; }; 41 | 87D8E50B1821577E00546E6D /* ALNetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4D91821577E00546E6D /* ALNetwork.m */; }; 42 | 87D8E50C1821577E00546E6D /* ALProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4DB1821577E00546E6D /* ALProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; 43 | 87D8E50D1821577E00546E6D /* ALProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4DC1821577E00546E6D /* ALProcessor.m */; }; 44 | 87D8E5101821577E00546E6D /* ALSystem_AccessoryConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E01821577E00546E6D /* ALSystem_AccessoryConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 45 | 87D8E5111821577E00546E6D /* ALSystem_ALBatteryConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E11821577E00546E6D /* ALSystem_ALBatteryConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 46 | 87D8E5121821577E00546E6D /* ALSystem_CarrierConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E21821577E00546E6D /* ALSystem_CarrierConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 47 | 87D8E5131821577E00546E6D /* ALSystem_DiskConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E31821577E00546E6D /* ALSystem_DiskConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 48 | 87D8E5141821577E00546E6D /* ALSystem_HardwareConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E41821577E00546E6D /* ALSystem_HardwareConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 49 | 87D8E5151821577E00546E6D /* ALSystem_JailbreakConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E51821577E00546E6D /* ALSystem_JailbreakConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 50 | 87D8E5161821577E00546E6D /* ALSystem_LocalizationConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E61821577E00546E6D /* ALSystem_LocalizationConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 51 | 87D8E5171821577E00546E6D /* ALSystem_MemoryConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E71821577E00546E6D /* ALSystem_MemoryConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 52 | 87D8E5181821577E00546E6D /* ALSystem_NetworkConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E81821577E00546E6D /* ALSystem_NetworkConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53 | 87D8E5191821577E00546E6D /* ALSystem_ProcessorConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4E91821577E00546E6D /* ALSystem_ProcessorConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 54 | 87D8E51A1821577E00546E6D /* ALSystemConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4EA1821577E00546E6D /* ALSystemConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 55 | 87D8E51B1821577E00546E6D /* Reachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 87D8E4EC1821577E00546E6D /* Reachability.h */; settings = {ATTRIBUTES = (Public, ); }; }; 56 | 87D8E51C1821577E00546E6D /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D8E4ED1821577E00546E6D /* Reachability.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 57 | 87D8E51D1821577E00546E6D /* iPhone3Gs.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F01821577E00546E6D /* iPhone3Gs.plist */; }; 58 | 87D8E51E1821577E00546E6D /* iPhone4.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F11821577E00546E6D /* iPhone4.plist */; }; 59 | 87D8E51F1821577E00546E6D /* iPhone4s.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F21821577E00546E6D /* iPhone4s.plist */; }; 60 | 87D8E5201821577E00546E6D /* iPhone5.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F31821577E00546E6D /* iPhone5.plist */; }; 61 | 87D8E5211821577E00546E6D /* iPhone5c.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F41821577E00546E6D /* iPhone5c.plist */; }; 62 | 87D8E5221821577E00546E6D /* iPhone5s.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F51821577E00546E6D /* iPhone5s.plist */; }; 63 | 87D8E5231821577E00546E6D /* iPodTouch3.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F71821577E00546E6D /* iPodTouch3.plist */; }; 64 | 87D8E5241821577E00546E6D /* iPodTouch4.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F81821577E00546E6D /* iPodTouch4.plist */; }; 65 | 87D8E5251821577E00546E6D /* iPodTouch5.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87D8E4F91821577E00546E6D /* iPodTouch5.plist */; }; 66 | /* End PBXBuildFile section */ 67 | 68 | /* Begin PBXFileReference section */ 69 | 0449A8BE183A019800970366 /* ALSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem.h; sourceTree = ""; }; 70 | 0449A8BF183A019800970366 /* ALSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALSystem.m; sourceTree = ""; }; 71 | 0449A8C2183A01C800970366 /* 3RPartyHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 3RPartyHelper.h; sourceTree = ""; }; 72 | 8710CC9C18227461009590EE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 73 | 8710CC9D18227461009590EE /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; 74 | 8710CC9E18227461009590EE /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; 75 | 8710CC9F18227461009590EE /* ExternalAccessory.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExternalAccessory.framework; path = System/Library/Frameworks/ExternalAccessory.framework; sourceTree = SDKROOT; }; 76 | 8710CCA018227461009590EE /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 77 | 8710CCA118227461009590EE /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 78 | 87D8E4A4182156D300546E6D /* ALSystemUtilities.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ALSystemUtilities.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 79 | 87D8E4A8182156D300546E6D /* ALSystemUtilities-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ALSystemUtilities-Info.plist"; sourceTree = ""; }; 80 | 87D8E4AA182156D300546E6D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 81 | 87D8E4AC182156D300546E6D /* ALSystemUtilities-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ALSystemUtilities-Prefix.pch"; sourceTree = ""; }; 82 | 87D8E4B6182156FB00546E6D /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 83 | 87D8E4B7182156FB00546E6D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 84 | 87D8E4BA1821570000546E6D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 85 | 87D8E4BC1821570500546E6D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 86 | 87D8E4C01821577E00546E6D /* ALAccessory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALAccessory.h; sourceTree = ""; }; 87 | 87D8E4C11821577E00546E6D /* ALAccessory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALAccessory.m; sourceTree = ""; }; 88 | 87D8E4C31821577E00546E6D /* ALBattery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALBattery.h; sourceTree = ""; }; 89 | 87D8E4C41821577E00546E6D /* ALBattery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALBattery.m; sourceTree = ""; }; 90 | 87D8E4C61821577E00546E6D /* ALCarrier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALCarrier.h; sourceTree = ""; }; 91 | 87D8E4C71821577E00546E6D /* ALCarrier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALCarrier.m; sourceTree = ""; }; 92 | 87D8E4C91821577E00546E6D /* ALDisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALDisk.h; sourceTree = ""; }; 93 | 87D8E4CA1821577E00546E6D /* ALDisk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALDisk.m; sourceTree = ""; }; 94 | 87D8E4CC1821577E00546E6D /* ALHardware.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALHardware.h; sourceTree = ""; }; 95 | 87D8E4CD1821577E00546E6D /* ALHardware.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALHardware.m; sourceTree = ""; }; 96 | 87D8E4CF1821577E00546E6D /* ALJailbreak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALJailbreak.h; sourceTree = ""; }; 97 | 87D8E4D01821577E00546E6D /* ALJailbreak.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALJailbreak.m; sourceTree = ""; }; 98 | 87D8E4D21821577E00546E6D /* ALLocalization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALLocalization.h; sourceTree = ""; }; 99 | 87D8E4D31821577E00546E6D /* ALLocalization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALLocalization.m; sourceTree = ""; }; 100 | 87D8E4D51821577E00546E6D /* ALMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALMemory.h; sourceTree = ""; }; 101 | 87D8E4D61821577E00546E6D /* ALMemory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALMemory.m; sourceTree = ""; }; 102 | 87D8E4D81821577E00546E6D /* ALNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALNetwork.h; sourceTree = ""; }; 103 | 87D8E4D91821577E00546E6D /* ALNetwork.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALNetwork.m; sourceTree = ""; }; 104 | 87D8E4DB1821577E00546E6D /* ALProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALProcessor.h; sourceTree = ""; }; 105 | 87D8E4DC1821577E00546E6D /* ALProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALProcessor.m; sourceTree = ""; }; 106 | 87D8E4E01821577E00546E6D /* ALSystem_AccessoryConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_AccessoryConstants.h; sourceTree = ""; }; 107 | 87D8E4E11821577E00546E6D /* ALSystem_ALBatteryConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_ALBatteryConstants.h; sourceTree = ""; }; 108 | 87D8E4E21821577E00546E6D /* ALSystem_CarrierConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_CarrierConstants.h; sourceTree = ""; }; 109 | 87D8E4E31821577E00546E6D /* ALSystem_DiskConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_DiskConstants.h; sourceTree = ""; }; 110 | 87D8E4E41821577E00546E6D /* ALSystem_HardwareConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_HardwareConstants.h; sourceTree = ""; }; 111 | 87D8E4E51821577E00546E6D /* ALSystem_JailbreakConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_JailbreakConstants.h; sourceTree = ""; }; 112 | 87D8E4E61821577E00546E6D /* ALSystem_LocalizationConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_LocalizationConstants.h; sourceTree = ""; }; 113 | 87D8E4E71821577E00546E6D /* ALSystem_MemoryConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_MemoryConstants.h; sourceTree = ""; }; 114 | 87D8E4E81821577E00546E6D /* ALSystem_NetworkConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_NetworkConstants.h; sourceTree = ""; }; 115 | 87D8E4E91821577E00546E6D /* ALSystem_ProcessorConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystem_ProcessorConstants.h; sourceTree = ""; }; 116 | 87D8E4EA1821577E00546E6D /* ALSystemConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALSystemConstants.h; sourceTree = ""; }; 117 | 87D8E4EC1821577E00546E6D /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; 118 | 87D8E4ED1821577E00546E6D /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; 119 | 87D8E4F01821577E00546E6D /* iPhone3Gs.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPhone3Gs.plist; sourceTree = ""; }; 120 | 87D8E4F11821577E00546E6D /* iPhone4.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPhone4.plist; sourceTree = ""; }; 121 | 87D8E4F21821577E00546E6D /* iPhone4s.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPhone4s.plist; sourceTree = ""; }; 122 | 87D8E4F31821577E00546E6D /* iPhone5.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPhone5.plist; sourceTree = ""; }; 123 | 87D8E4F41821577E00546E6D /* iPhone5c.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPhone5c.plist; sourceTree = ""; }; 124 | 87D8E4F51821577E00546E6D /* iPhone5s.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPhone5s.plist; sourceTree = ""; }; 125 | 87D8E4F71821577E00546E6D /* iPodTouch3.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPodTouch3.plist; sourceTree = ""; }; 126 | 87D8E4F81821577E00546E6D /* iPodTouch4.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPodTouch4.plist; sourceTree = ""; }; 127 | 87D8E4F91821577E00546E6D /* iPodTouch5.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = iPodTouch5.plist; sourceTree = ""; }; 128 | /* End PBXFileReference section */ 129 | 130 | /* Begin PBXFrameworksBuildPhase section */ 131 | 87D8E49F182156D300546E6D /* Frameworks */ = { 132 | isa = PBXFrameworksBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | 8710CCA218227461009590EE /* AudioToolbox.framework in Frameworks */, 136 | 8710CCA318227461009590EE /* CFNetwork.framework in Frameworks */, 137 | 8710CCA418227461009590EE /* CoreTelephony.framework in Frameworks */, 138 | 8710CCA518227461009590EE /* ExternalAccessory.framework in Frameworks */, 139 | 8710CCA618227461009590EE /* Security.framework in Frameworks */, 140 | 8710CCA718227461009590EE /* SystemConfiguration.framework in Frameworks */, 141 | 87D8E4BD1821570500546E6D /* UIKit.framework in Frameworks */, 142 | 87D8E4BB1821570000546E6D /* CoreGraphics.framework in Frameworks */, 143 | 87D8E4B8182156FB00546E6D /* CoreFoundation.framework in Frameworks */, 144 | 87D8E4B9182156FB00546E6D /* Foundation.framework in Frameworks */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXFrameworksBuildPhase section */ 149 | 150 | /* Begin PBXGroup section */ 151 | 0449A8BD183A019700970366 /* ALSystem */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 0449A8BE183A019800970366 /* ALSystem.h */, 155 | 0449A8BF183A019800970366 /* ALSystem.m */, 156 | ); 157 | path = ALSystem; 158 | sourceTree = ""; 159 | }; 160 | 87D8E499182156D300546E6D = { 161 | isa = PBXGroup; 162 | children = ( 163 | 87D8E4A6182156D300546E6D /* ALSystemUtilities */, 164 | 87D8E526182157EC00546E6D /* Frameworks */, 165 | 87D8E4A5182156D300546E6D /* Products */, 166 | ); 167 | sourceTree = ""; 168 | }; 169 | 87D8E4A5182156D300546E6D /* Products */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | 87D8E4A4182156D300546E6D /* ALSystemUtilities.framework */, 173 | ); 174 | name = Products; 175 | sourceTree = ""; 176 | }; 177 | 87D8E4A6182156D300546E6D /* ALSystemUtilities */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 87D8E4BE1821577E00546E6D /* ALSystemUtilities */, 181 | 87D8E4A7182156D300546E6D /* Supporting Files */, 182 | ); 183 | path = ALSystemUtilities; 184 | sourceTree = ""; 185 | }; 186 | 87D8E4A7182156D300546E6D /* Supporting Files */ = { 187 | isa = PBXGroup; 188 | children = ( 189 | 87D8E4A8182156D300546E6D /* ALSystemUtilities-Info.plist */, 190 | 87D8E4A9182156D300546E6D /* InfoPlist.strings */, 191 | 87D8E4AC182156D300546E6D /* ALSystemUtilities-Prefix.pch */, 192 | ); 193 | name = "Supporting Files"; 194 | sourceTree = ""; 195 | }; 196 | 87D8E4BE1821577E00546E6D /* ALSystemUtilities */ = { 197 | isa = PBXGroup; 198 | children = ( 199 | 0449A8BD183A019700970366 /* ALSystem */, 200 | 87D8E4BF1821577E00546E6D /* ALAccessory */, 201 | 87D8E4C21821577E00546E6D /* ALBattery */, 202 | 87D8E4C51821577E00546E6D /* ALCarrier */, 203 | 87D8E4C81821577E00546E6D /* ALDisk */, 204 | 87D8E4CB1821577E00546E6D /* ALHardware */, 205 | 87D8E4CE1821577E00546E6D /* ALJailbreak */, 206 | 87D8E4D11821577E00546E6D /* ALLocalization */, 207 | 87D8E4D41821577E00546E6D /* ALMemory */, 208 | 87D8E4D71821577E00546E6D /* ALNetwork */, 209 | 87D8E4DA1821577E00546E6D /* ALProcessor */, 210 | 87D8E4DF1821577E00546E6D /* ALSystemConstants */, 211 | 87D8E4EB1821577E00546E6D /* Reachability */, 212 | 87D8E4EE1821577E00546E6D /* Resources */, 213 | 0449A8C2183A01C800970366 /* 3RPartyHelper.h */, 214 | ); 215 | path = ALSystemUtilities; 216 | sourceTree = ""; 217 | }; 218 | 87D8E4BF1821577E00546E6D /* ALAccessory */ = { 219 | isa = PBXGroup; 220 | children = ( 221 | 87D8E4C01821577E00546E6D /* ALAccessory.h */, 222 | 87D8E4C11821577E00546E6D /* ALAccessory.m */, 223 | ); 224 | path = ALAccessory; 225 | sourceTree = ""; 226 | }; 227 | 87D8E4C21821577E00546E6D /* ALBattery */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | 87D8E4C31821577E00546E6D /* ALBattery.h */, 231 | 87D8E4C41821577E00546E6D /* ALBattery.m */, 232 | ); 233 | path = ALBattery; 234 | sourceTree = ""; 235 | }; 236 | 87D8E4C51821577E00546E6D /* ALCarrier */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | 87D8E4C61821577E00546E6D /* ALCarrier.h */, 240 | 87D8E4C71821577E00546E6D /* ALCarrier.m */, 241 | ); 242 | path = ALCarrier; 243 | sourceTree = ""; 244 | }; 245 | 87D8E4C81821577E00546E6D /* ALDisk */ = { 246 | isa = PBXGroup; 247 | children = ( 248 | 87D8E4C91821577E00546E6D /* ALDisk.h */, 249 | 87D8E4CA1821577E00546E6D /* ALDisk.m */, 250 | ); 251 | path = ALDisk; 252 | sourceTree = ""; 253 | }; 254 | 87D8E4CB1821577E00546E6D /* ALHardware */ = { 255 | isa = PBXGroup; 256 | children = ( 257 | 87D8E4CC1821577E00546E6D /* ALHardware.h */, 258 | 87D8E4CD1821577E00546E6D /* ALHardware.m */, 259 | ); 260 | path = ALHardware; 261 | sourceTree = ""; 262 | }; 263 | 87D8E4CE1821577E00546E6D /* ALJailbreak */ = { 264 | isa = PBXGroup; 265 | children = ( 266 | 87D8E4CF1821577E00546E6D /* ALJailbreak.h */, 267 | 87D8E4D01821577E00546E6D /* ALJailbreak.m */, 268 | ); 269 | path = ALJailbreak; 270 | sourceTree = ""; 271 | }; 272 | 87D8E4D11821577E00546E6D /* ALLocalization */ = { 273 | isa = PBXGroup; 274 | children = ( 275 | 87D8E4D21821577E00546E6D /* ALLocalization.h */, 276 | 87D8E4D31821577E00546E6D /* ALLocalization.m */, 277 | ); 278 | path = ALLocalization; 279 | sourceTree = ""; 280 | }; 281 | 87D8E4D41821577E00546E6D /* ALMemory */ = { 282 | isa = PBXGroup; 283 | children = ( 284 | 87D8E4D51821577E00546E6D /* ALMemory.h */, 285 | 87D8E4D61821577E00546E6D /* ALMemory.m */, 286 | ); 287 | path = ALMemory; 288 | sourceTree = ""; 289 | }; 290 | 87D8E4D71821577E00546E6D /* ALNetwork */ = { 291 | isa = PBXGroup; 292 | children = ( 293 | 87D8E4D81821577E00546E6D /* ALNetwork.h */, 294 | 87D8E4D91821577E00546E6D /* ALNetwork.m */, 295 | ); 296 | path = ALNetwork; 297 | sourceTree = ""; 298 | }; 299 | 87D8E4DA1821577E00546E6D /* ALProcessor */ = { 300 | isa = PBXGroup; 301 | children = ( 302 | 87D8E4DB1821577E00546E6D /* ALProcessor.h */, 303 | 87D8E4DC1821577E00546E6D /* ALProcessor.m */, 304 | ); 305 | path = ALProcessor; 306 | sourceTree = ""; 307 | }; 308 | 87D8E4DF1821577E00546E6D /* ALSystemConstants */ = { 309 | isa = PBXGroup; 310 | children = ( 311 | 87D8E4E01821577E00546E6D /* ALSystem_AccessoryConstants.h */, 312 | 87D8E4E11821577E00546E6D /* ALSystem_ALBatteryConstants.h */, 313 | 87D8E4E21821577E00546E6D /* ALSystem_CarrierConstants.h */, 314 | 87D8E4E31821577E00546E6D /* ALSystem_DiskConstants.h */, 315 | 87D8E4E41821577E00546E6D /* ALSystem_HardwareConstants.h */, 316 | 87D8E4E51821577E00546E6D /* ALSystem_JailbreakConstants.h */, 317 | 87D8E4E61821577E00546E6D /* ALSystem_LocalizationConstants.h */, 318 | 87D8E4E71821577E00546E6D /* ALSystem_MemoryConstants.h */, 319 | 87D8E4E81821577E00546E6D /* ALSystem_NetworkConstants.h */, 320 | 87D8E4E91821577E00546E6D /* ALSystem_ProcessorConstants.h */, 321 | 87D8E4EA1821577E00546E6D /* ALSystemConstants.h */, 322 | ); 323 | path = ALSystemConstants; 324 | sourceTree = ""; 325 | }; 326 | 87D8E4EB1821577E00546E6D /* Reachability */ = { 327 | isa = PBXGroup; 328 | children = ( 329 | 87D8E4EC1821577E00546E6D /* Reachability.h */, 330 | 87D8E4ED1821577E00546E6D /* Reachability.m */, 331 | ); 332 | path = Reachability; 333 | sourceTree = ""; 334 | }; 335 | 87D8E4EE1821577E00546E6D /* Resources */ = { 336 | isa = PBXGroup; 337 | children = ( 338 | 87D8E4EF1821577E00546E6D /* iPhone */, 339 | 87D8E4F61821577E00546E6D /* iPodTouch */, 340 | ); 341 | path = Resources; 342 | sourceTree = ""; 343 | }; 344 | 87D8E4EF1821577E00546E6D /* iPhone */ = { 345 | isa = PBXGroup; 346 | children = ( 347 | 87D8E4F01821577E00546E6D /* iPhone3Gs.plist */, 348 | 87D8E4F11821577E00546E6D /* iPhone4.plist */, 349 | 87D8E4F21821577E00546E6D /* iPhone4s.plist */, 350 | 87D8E4F31821577E00546E6D /* iPhone5.plist */, 351 | 87D8E4F41821577E00546E6D /* iPhone5c.plist */, 352 | 87D8E4F51821577E00546E6D /* iPhone5s.plist */, 353 | ); 354 | path = iPhone; 355 | sourceTree = ""; 356 | }; 357 | 87D8E4F61821577E00546E6D /* iPodTouch */ = { 358 | isa = PBXGroup; 359 | children = ( 360 | 87D8E4F71821577E00546E6D /* iPodTouch3.plist */, 361 | 87D8E4F81821577E00546E6D /* iPodTouch4.plist */, 362 | 87D8E4F91821577E00546E6D /* iPodTouch5.plist */, 363 | ); 364 | path = iPodTouch; 365 | sourceTree = ""; 366 | }; 367 | 87D8E526182157EC00546E6D /* Frameworks */ = { 368 | isa = PBXGroup; 369 | children = ( 370 | 8710CC9C18227461009590EE /* AudioToolbox.framework */, 371 | 8710CC9D18227461009590EE /* CFNetwork.framework */, 372 | 8710CC9E18227461009590EE /* CoreTelephony.framework */, 373 | 8710CC9F18227461009590EE /* ExternalAccessory.framework */, 374 | 8710CCA018227461009590EE /* Security.framework */, 375 | 8710CCA118227461009590EE /* SystemConfiguration.framework */, 376 | 87D8E4BC1821570500546E6D /* UIKit.framework */, 377 | 87D8E4BA1821570000546E6D /* CoreGraphics.framework */, 378 | 87D8E4B6182156FB00546E6D /* CoreFoundation.framework */, 379 | 87D8E4B7182156FB00546E6D /* Foundation.framework */, 380 | ); 381 | name = Frameworks; 382 | sourceTree = ""; 383 | }; 384 | /* End PBXGroup section */ 385 | 386 | /* Begin PBXHeadersBuildPhase section */ 387 | 87D8E4A0182156D300546E6D /* Headers */ = { 388 | isa = PBXHeadersBuildPhase; 389 | buildActionMask = 2147483647; 390 | files = ( 391 | 87D8E5181821577E00546E6D /* ALSystem_NetworkConstants.h in Headers */, 392 | 87D8E5141821577E00546E6D /* ALSystem_HardwareConstants.h in Headers */, 393 | 87D8E4FC1821577E00546E6D /* ALBattery.h in Headers */, 394 | 87D8E5161821577E00546E6D /* ALSystem_LocalizationConstants.h in Headers */, 395 | 87D8E5171821577E00546E6D /* ALSystem_MemoryConstants.h in Headers */, 396 | 87D8E5041821577E00546E6D /* ALJailbreak.h in Headers */, 397 | 87D8E5191821577E00546E6D /* ALSystem_ProcessorConstants.h in Headers */, 398 | 87D8E50A1821577E00546E6D /* ALNetwork.h in Headers */, 399 | 87D8E5021821577E00546E6D /* ALHardware.h in Headers */, 400 | 87D8E4FA1821577E00546E6D /* ALAccessory.h in Headers */, 401 | 87D8E5101821577E00546E6D /* ALSystem_AccessoryConstants.h in Headers */, 402 | 87D8E5131821577E00546E6D /* ALSystem_DiskConstants.h in Headers */, 403 | 87D8E5111821577E00546E6D /* ALSystem_ALBatteryConstants.h in Headers */, 404 | 87D8E51A1821577E00546E6D /* ALSystemConstants.h in Headers */, 405 | 87D8E5151821577E00546E6D /* ALSystem_JailbreakConstants.h in Headers */, 406 | 87D8E5061821577E00546E6D /* ALLocalization.h in Headers */, 407 | 87D8E50C1821577E00546E6D /* ALProcessor.h in Headers */, 408 | 87D8E5081821577E00546E6D /* ALMemory.h in Headers */, 409 | 87D8E5121821577E00546E6D /* ALSystem_CarrierConstants.h in Headers */, 410 | 87D8E5001821577E00546E6D /* ALDisk.h in Headers */, 411 | 87D8E51B1821577E00546E6D /* Reachability.h in Headers */, 412 | 87D8E4FE1821577E00546E6D /* ALCarrier.h in Headers */, 413 | 0449A8C0183A019800970366 /* ALSystem.h in Headers */, 414 | 0449A8C3183A01CA00970366 /* 3RPartyHelper.h in Headers */, 415 | ); 416 | runOnlyForDeploymentPostprocessing = 0; 417 | }; 418 | /* End PBXHeadersBuildPhase section */ 419 | 420 | /* Begin PBXNativeTarget section */ 421 | 87D8E4A3182156D300546E6D /* ALSystemUtilities */ = { 422 | isa = PBXNativeTarget; 423 | buildConfigurationList = 87D8E4B2182156D300546E6D /* Build configuration list for PBXNativeTarget "ALSystemUtilities" */; 424 | buildPhases = ( 425 | 87D8E49E182156D300546E6D /* Sources */, 426 | 87D8E49F182156D300546E6D /* Frameworks */, 427 | 87D8E4A0182156D300546E6D /* Headers */, 428 | 87D8E4A1182156D300546E6D /* Resources */, 429 | 87D8E4A2182156D300546E6D /* ShellScript */, 430 | ); 431 | buildRules = ( 432 | ); 433 | dependencies = ( 434 | ); 435 | name = ALSystemUtilities; 436 | productName = ALSystemUtilities; 437 | productReference = 87D8E4A4182156D300546E6D /* ALSystemUtilities.framework */; 438 | productType = "com.apple.product-type.bundle"; 439 | }; 440 | /* End PBXNativeTarget section */ 441 | 442 | /* Begin PBXProject section */ 443 | 87D8E49A182156D300546E6D /* Project object */ = { 444 | isa = PBXProject; 445 | attributes = { 446 | LastUpgradeCheck = 0500; 447 | ORGANIZATIONNAME = "Andrea Mario Lufino"; 448 | }; 449 | buildConfigurationList = 87D8E49D182156D300546E6D /* Build configuration list for PBXProject "ALSystemUtilities" */; 450 | compatibilityVersion = "Xcode 3.2"; 451 | developmentRegion = English; 452 | hasScannedForEncodings = 0; 453 | knownRegions = ( 454 | en, 455 | ); 456 | mainGroup = 87D8E499182156D300546E6D; 457 | productRefGroup = 87D8E4A5182156D300546E6D /* Products */; 458 | projectDirPath = ""; 459 | projectRoot = ""; 460 | targets = ( 461 | 87D8E4A3182156D300546E6D /* ALSystemUtilities */, 462 | ); 463 | }; 464 | /* End PBXProject section */ 465 | 466 | /* Begin PBXResourcesBuildPhase section */ 467 | 87D8E4A1182156D300546E6D /* Resources */ = { 468 | isa = PBXResourcesBuildPhase; 469 | buildActionMask = 2147483647; 470 | files = ( 471 | 87D8E4AB182156D300546E6D /* InfoPlist.strings in Resources */, 472 | 87D8E51D1821577E00546E6D /* iPhone3Gs.plist in Resources */, 473 | 87D8E51F1821577E00546E6D /* iPhone4s.plist in Resources */, 474 | 87D8E51E1821577E00546E6D /* iPhone4.plist in Resources */, 475 | 87D8E5231821577E00546E6D /* iPodTouch3.plist in Resources */, 476 | 87D8E5221821577E00546E6D /* iPhone5s.plist in Resources */, 477 | 87D8E5251821577E00546E6D /* iPodTouch5.plist in Resources */, 478 | 87D8E5201821577E00546E6D /* iPhone5.plist in Resources */, 479 | 87D8E5241821577E00546E6D /* iPodTouch4.plist in Resources */, 480 | 87D8E5211821577E00546E6D /* iPhone5c.plist in Resources */, 481 | ); 482 | runOnlyForDeploymentPostprocessing = 0; 483 | }; 484 | /* End PBXResourcesBuildPhase section */ 485 | 486 | /* Begin PBXShellScriptBuildPhase section */ 487 | 87D8E4A2182156D300546E6D /* ShellScript */ = { 488 | isa = PBXShellScriptBuildPhase; 489 | buildActionMask = 2147483647; 490 | files = ( 491 | ); 492 | inputPaths = ( 493 | ); 494 | outputPaths = ( 495 | ); 496 | runOnlyForDeploymentPostprocessing = 0; 497 | shellPath = /usr/bin/python; 498 | shellScript = "# TAG: BUILD SCRIPT (do not remove this comment)\n# Build script generated using https://github.com/kstenerud/iOS-Universal-Framework Mk 8 (beta 2012-06-16)\nimport logging\n\n\n##############################################################################\n#\n# Configuration\n#\n##############################################################################\n\n# Select which kind of framework to build.\n#\n# Note: Due to issues with Xcode's build process, if you select\n# 'embeddedframework', it will still show the regular framework\n# (as a symlink) along side of the embedded framework. Be sure to\n# instruct your users to copy/move the embedded framework in this case!\n#\n# If your framework contains resources such as images, nibs, momds, plists,\n# zipfiles and such, choose 'embeddedframework'.\n#\n# If your framework contains no resources, choose 'framework'.\n#\nconfig_framework_type = 'framework'\n#config_framework_type = 'embeddedframework'\n\n# Open the build directory in Finder when the universal framework is\n# successfully built.\n#\n# This value can be overridden by setting the UFW_OPEN_BUILD_DIR env variable\n# to True or False.\n#\n# Recommended setting: True\n#\nconfig_open_build_dir = True\n\n# If true, ensures that all public headers are stored in the framework under\n# the same directory hierarchy as they were in the source tree.\n#\n# Xcode by default places all headers at the same top level, but every other\n# build tool in the known universe preserves directory structure. For simple\n# libraries it doesn't really matter much, but for ports of existing software\n# packages or for bigger libraries, it makes sense to have more structure.\n#\n# The default is set to \"False\" since that's what most Xcode users are used to.\n#\n# Recommended setting: True for deep hierarchy projects, False otherwise.\n#\nconfig_deep_header_hierarchy = False\n\n# Specify where the top of the public header hierarchy is. This path is\n# relative to the project's dir (PROJECT_DIR). You can reference environment\n# variables using templating syntax (e.g. \"${TARGET_NAME}/Some/Subdir\")\n#\n# NOTE: Only used if config_deep_header_hierarchy is True.\n#\n# If this is set to None, the script will attempt to figure out for itself\n# where the top of the header hierarchy is by looking for common path prefixes\n# in the public header files. This process can fail if:\n# - You only have one public header file.\n# - Your source header files don't all have a common root.\n#\n# A common approach is to use \"${TARGET_NAME}\", working under the assumption\n# that all of your header files share the common root of a directory under\n# your project with the same name as your target (which is the Xcode default).\n#\n# Recommended setting: \"${TARGET_NAME}\"\n#\nconfig_deep_header_top = \"${TARGET_NAME}\"\n\n# Warn when \"DerivedData\" is detected in any of the header, library, or\n# framework search paths. In almost all cases, references to directories under\n# DerivedData are added as a result of an Xcode bug and must be manually\n# removed.\n#\n# Recommended setting: True\n#\nconfig_warn_derived_data = True\n\n# Warn if no headers were marked public in this framework.\n#\n# Recommended setting: True\n#\nconfig_warn_no_public_headers = True\n\n# Cause the build to fail if any warnings are issued.\n#\n# Recommended setting: True\n#\nconfig_fail_on_warnings = True\n\n# Minimum log level\n#\n# Recommended setting: logging.INFO\n#\nconfig_log_level = logging.INFO\n\n\n##############################################################################\n#\n# Don't touch anything below here unless you know what you're doing.\n#\n##############################################################################\n\nimport collections\nimport json\nimport os\nimport re\nimport shlex\nimport shutil\nimport string\nimport subprocess\nimport sys\nimport time\nimport traceback\n\n\n##############################################################################\n#\n# Globals\n#\n##############################################################################\n\nlog = logging.getLogger('UFW')\n\nissued_warnings = False\n\n\n##############################################################################\n#\n# Classes\n#\n##############################################################################\n\n# Allows the slave build to communicate with the master build.\n#\nclass BuildState:\n\n def __init__(self):\n self.reload()\n\n def reset(self):\n self.slave_platform = None\n self.slave_architectures = []\n self.slave_linked_archive_paths = []\n self.slave_built_fw_path = None\n self.slave_built_embedded_fw_path = None\n\n def set_slave_properties(self, architectures,\n linked_archive_paths,\n built_fw_path,\n built_embedded_fw_path):\n self.slave_platform = os.environ['PLATFORM_NAME']\n self.slave_architectures = architectures\n self.slave_linked_archive_paths = linked_archive_paths\n self.slave_built_fw_path = built_fw_path\n self.slave_built_embedded_fw_path = built_embedded_fw_path\n\n def get_save_path(self):\n return os.path.join(os.environ['PROJECT_TEMP_DIR'], \"ufw_build_state.json\")\n\n def persist(self):\n filename = self.get_save_path()\n parent = os.path.dirname(filename)\n if not os.path.isdir(parent):\n os.makedirs(parent)\n with open(filename, \"w\") as f:\n f.write(json.dumps(self.__dict__))\n\n def reload(self):\n self.reset()\n filename = self.get_save_path()\n if os.path.exists(filename):\n with open(filename, \"r\") as f:\n new_dict = json.loads(f.read())\n if new_dict is not None:\n self.__dict__ = dict(self.__dict__.items() + new_dict.items())\n\n\n# Holds information about the current project and build environment.\n#\nclass Project:\n\n def __init__(self, filename):\n sourcecode_types = ['sourcecode.c.c',\n 'sourcecode.c.objc',\n 'sourcecode.cpp.cpp',\n 'sourcecode.cpp.objcpp',\n 'sourcecode.asm.asm',\n 'sourcecode.asm.llvm',\n 'sourcecode.nasm']\n\n self.build_state = BuildState()\n self.project_data = self.load_from_file(filename)\n self.target = filter(lambda x: x['name'] == os.environ['TARGET_NAME'], self.project_data['targets'])[0]\n self.public_headers = self.get_build_phase_files('PBXHeadersBuildPhase', lambda x: x.get('settings', False) and x['settings'].get('ATTRIBUTES', False) and 'Public' in x['settings']['ATTRIBUTES'])\n self.static_libraries = self.get_build_phase_files('PBXFrameworksBuildPhase', lambda x: x['fileRef']['fileType'] == 'archive.ar' and x['fileRef']['sourceTree'] not in ['DEVELOPER_DIR', 'SDKROOT'])\n self.static_frameworks = self.get_build_phase_files('PBXFrameworksBuildPhase', lambda x: x['fileRef']['fileType'] == 'wrapper.framework' and x['fileRef']['sourceTree'] not in ['DEVELOPER_DIR', 'SDKROOT'])\n self.compilable_sources = self.get_build_phase_files('PBXSourcesBuildPhase', lambda x: x['fileRef']['fileType'] in sourcecode_types)\n self.header_paths = [os.path.join(*x['pathComponents']) for x in self.public_headers]\n\n self.headers_dir = os.path.join(os.environ['TARGET_BUILD_DIR'], os.environ['CONTENTS_FOLDER_PATH'], 'Headers')\n self.libtool_path = os.path.join(os.environ['DT_TOOLCHAIN_DIR'], 'usr', 'bin', 'libtool')\n self.project_filename = os.path.join(os.environ['PROJECT_FILE_PATH'], \"project.pbxproj\")\n self.local_exe_path = os.path.join(os.environ['TARGET_BUILD_DIR'], os.environ['EXECUTABLE_PATH'])\n self.local_architectures = os.environ['ARCHS'].split(' ')\n self.local_built_fw_path = os.path.join(os.environ['TARGET_BUILD_DIR'], os.environ['WRAPPER_NAME'])\n self.local_built_embedded_fw_path = os.path.splitext(self.local_built_fw_path)[0] + \".embeddedframework\"\n self.local_linked_archive_paths = [self.get_linked_ufw_archive_path(arch) for arch in self.local_architectures]\n self.local_platform = os.environ['PLATFORM_NAME']\n other_platforms = os.environ['SUPPORTED_PLATFORMS'].split(' ')\n other_platforms.remove(self.local_platform)\n self.other_platform = other_platforms[0]\n\n sdk_name = os.environ['SDK_NAME']\n if not sdk_name.startswith(self.local_platform):\n raise Exception(\"%s didn't start with %s\" % (sdk_name, self.local_platform))\n self.sdk_version = sdk_name[len(self.local_platform):]\n\n # Load an Xcode project file.\n #\n def load_from_file(self, filename):\n project_file = json.loads(subprocess.check_output([\"plutil\", \"-convert\", \"json\", \"-o\", \"-\", filename]))\n all_objects = project_file['objects']\n del project_file['objects']\n for obj in all_objects.values():\n self.fix_keys(obj)\n self.unpack_objects(self.build_dereference_list(all_objects, None, None, project_file))\n self.unpack_objects(self.build_dereference_list(all_objects, None, None, all_objects.values()))\n project_data = project_file['rootObject']\n self.build_full_paths(project_data, splitpath(os.environ['SOURCE_ROOT']))\n return project_data\n\n def is_key(self, obj): \n return isinstance(obj, basestring) and len(obj) == 24 and re.search('^[0-9a-fA-F]+$', obj) is not None\n \n def build_dereference_list(self, all_objects, parent, key, obj):\n deref_list = []\n if self.is_key(obj):\n dereferenced = all_objects.get(obj, obj)\n if dereferenced is not obj:\n deref_list.append((parent, key, obj, dereferenced))\n elif isinstance(obj, collections.Mapping):\n for k, v in obj.iteritems():\n deref_list += self.build_dereference_list(all_objects, obj, k, v)\n elif isinstance(obj, collections.Iterable) and not isinstance(obj, basestring):\n for item in obj:\n deref_list += self.build_dereference_list(all_objects, obj, None, item)\n return deref_list\n \n def unpack_objects(self, deref_list):\n for parent, key, orig, obj in deref_list:\n if key is None:\n parent.remove(orig)\n parent.append(obj)\n else:\n parent[key] = obj\n\n # Store the full path, separated into components, to a node inside the node\n # as \"pathComponents\". Also recurse into that node if it's a group.\n #\n def build_full_paths(self, node, base_path):\n # Some nodes are relative to a different source tree, specified as an\n # env variable.\n if node.get('sourceTree', '') != '':\n new_base_path = os.environ.get(node['sourceTree'], None)\n if new_base_path:\n base_path = splitpath(new_base_path)\n # Add the current node's path, if any.\n if node.get('path', False):\n base_path = base_path + splitpath(node['path'])\n node['pathComponents'] = base_path\n # Recurse if this is a group.\n if node['isa'] == 'PBXGroup':\n for child in node['children']:\n self.build_full_paths(child, base_path)\n elif node['isa'] == 'PBXProject':\n self.build_full_paths(node['mainGroup'], base_path)\n self.build_full_paths(node['productRefGroup'], base_path)\n for child in node['targets']:\n self.build_full_paths(child, base_path)\n projectRefs = node.get('projectReferences', None)\n if projectRefs is not None:\n for child in projectRefs[0].values():\n self.build_full_paths(child, base_path)\n\n # Fix up any inconvenient keys.\n #\n def fix_keys(self, obj):\n key_remappings = {'lastKnownFileType': 'fileType', 'explicitFileType': 'fileType'}\n for key in list(set(key_remappings.keys()) & set(obj.keys())):\n obj[key_remappings[key]] = obj[key]\n del obj[key]\n\n # Get the files from a build phase.\n #\n def get_build_phase_files(self, build_phase_name, filter_func):\n build_phase = filter(lambda x: x['isa'] == build_phase_name, self.target['buildPhases'])[0]\n build_files = filter(filter_func, build_phase['files'])\n return [x['fileRef'] for x in build_files]\n\n # Get the truncated paths of all headers that start with the specified\n # relative path. Paths are read and returned as fully separated lists.\n # e.g. ['Some', 'Path', 'To', 'A', 'Header'] with relative_path of\n # ['Some', 'Path'] gets truncated to ['To', 'A', 'Header']\n #\n def movable_headers_relative_to(self, relative_path):\n rel_path_length = len(relative_path)\n result = filter(lambda path: len(path) >= rel_path_length and\n path[:rel_path_length] == relative_path, self.header_paths)\n return [path[rel_path_length:] for path in result]\n\n # Get the full path to where a linkable archive (library or framework)\n # is supposed to be.\n #\n def get_linked_archive_path(self, architecture):\n return os.path.join(os.environ['OBJECT_FILE_DIR_%s' % os.environ['CURRENT_VARIANT']],\n architecture,\n os.environ['EXECUTABLE_NAME'])\n\n # Get the full path to our custom linked archive of the project.\n #\n def get_linked_ufw_archive_path(self, architecture):\n return self.get_linked_archive_path(architecture) + \".ufwbuild\"\n\n # Get the full path to the executable of an archive.\n #\n def get_exe_path(self, node):\n path = os.path.join(*node['pathComponents'])\n if node['fileType'] == 'wrapper.framework':\n # Frameworks are directories, so go one deeper\n path = os.path.join(path, os.path.splitext(node['pathComponents'][-1])[0])\n return path\n\n # Get the path to the directory containing the archive.\n #\n def get_containing_path(self, node):\n return os.path.join(*node['pathComponents'])\n \n def get_archive_search_paths(self):\n log.info(\"Search paths = %s\" % set([self.get_containing_path(fw) for fw in self.static_frameworks] + [self.get_containing_path(fw) for fw in self.static_libraries]))\n return set([self.get_containing_path(fw) for fw in self.static_frameworks] + [self.get_containing_path(fw) for fw in self.static_libraries])\n\n # Command to link all objects of a single architecture.\n #\n def get_single_arch_link_command(self, architecture):\n cmd = [self.libtool_path,\n \"-static\",\n \"-arch_only\", architecture,\n \"-syslibroot\", os.environ['SDKROOT'],\n \"-L%s\" % os.environ['TARGET_BUILD_DIR'],\n \"-filelist\", os.environ['LINK_FILE_LIST_%s_%s' % (os.environ['CURRENT_VARIANT'], architecture)]]\n if os.environ.get('OTHER_LDFLAGS', False):\n cmd += [os.environ['OTHER_LDFLAGS']]\n if os.environ.get('WARNING_LDFLAGS', False):\n cmd += [os.environ['WARNING_LDFLAGS']]\n# cmd += [\"-L%s\" % libpath for libpath in self.get_archive_search_paths()]\n cmd += [self.get_exe_path(fw) for fw in self.static_frameworks]\n cmd += [self.get_exe_path(lib) for lib in self.static_libraries]\n cmd += [\"-o\", self.get_linked_ufw_archive_path(architecture)]\n return cmd\n\n # Command to link all local architectures for the current configuration\n # into an archive. This reads all libraries + the UFW-built archives and\n # overwrites the final product.\n #\n def get_local_archs_link_command(self):\n cmd = [self.libtool_path,\n \"-static\"]\n cmd += self.local_linked_archive_paths\n cmd += [self.get_exe_path(fw) for fw in self.static_frameworks]\n cmd += [self.get_exe_path(lib) for lib in self.static_libraries]\n cmd += [\"-o\", os.path.join(os.environ['TARGET_BUILD_DIR'], os.environ['EXECUTABLE_PATH'])]\n return cmd\n\n # Command to link all architectures into a universal archive.\n # This reads all UFW-built archives and overwrites the final product.\n #\n def get_all_archs_link_command(self):\n cmd = [self.libtool_path,\n \"-static\"]\n cmd += self.local_linked_archive_paths + self.build_state.slave_linked_archive_paths\n cmd += [\"-o\", os.path.join(os.environ['TARGET_BUILD_DIR'], os.environ['EXECUTABLE_PATH'])]\n return cmd\n\n # Build up an environment for the slave process. This uses BUILD_ROOT\n # and TEMP_ROOT to convert all environment variables to values suitable\n # for the slave build environment so that xcodebuild doesn't try to build\n # in the project directory under \"build\".\n #\n def get_slave_environment(self):\n ignored = ['LD_MAP_FILE_PATH',\n 'HEADER_SEARCH_PATHS',\n 'LIBRARY_SEARCH_PATHS',\n 'FRAMEWORK_SEARCH_PATHS']\n build_root = os.environ['BUILD_ROOT']\n temp_root = os.environ['TEMP_ROOT']\n newenv = {}\n for key, value in os.environ.items():\n if key not in ignored and not key.startswith('LINK_FILE_LIST_') and not key.startswith('LD_DEPENDENCY_'):\n if build_root in value or temp_root in value:\n newenv[key] = value.replace(self.local_platform, self.other_platform)\n return newenv\n\n # Command to invoke xcodebuild on the slave platform.\n #\n def get_slave_project_build_command(self):\n cmd = [\"xcodebuild\",\n \"-project\",\n os.environ['PROJECT_FILE_PATH'],\n \"-target\",\n os.environ['TARGET_NAME'],\n \"-configuration\",\n os.environ['CONFIGURATION'],\n \"-sdk\",\n self.other_platform + self.sdk_version]\n cmd += [\"%s=%s\" % (key, value) for key, value in self.get_slave_environment().items()]\n cmd += [\"UFW_MASTER_PLATFORM=\" + os.environ['PLATFORM_NAME']]\n cmd += [os.environ['ACTION']]\n return cmd\n\n\n\n##############################################################################\n#\n# Utility Functions\n#\n##############################################################################\n\n# Split a path into a list of path components.\n#\ndef splitpath(path, maxdepth=20):\n (head, tail) = os.path.split(path)\n return splitpath(head, maxdepth - 1) + [tail] if maxdepth and head and head != path else [ head or tail ]\n\n# Remove all subdirectories under a path.\n#\ndef remove_subdirs(path, ignore_files):\n if os.path.exists(path):\n for filename in filter(lambda x: x not in ignore_files, os.listdir(path)):\n fullpath = os.path.join(path, filename)\n if os.path.isdir(fullpath):\n log.info(\"Remove %s\" % fullpath)\n shutil.rmtree(fullpath)\n\n# Make whatever parent paths are necessary for a path to exist.\n#\ndef ensure_path_exists(path):\n if not os.path.isdir(path):\n os.makedirs(path)\n\n# Make whatever parent paths are necessary for a path's parent to exist.\n#\ndef ensure_parent_exists(path):\n parent = os.path.dirname(path)\n if not os.path.isdir(parent):\n os.makedirs(parent)\n\n# Remove a file or dir if it exists.\n#\ndef remove_path(path):\n if os.path.exists(path):\n if os.path.isdir(path):\n shutil.rmtree(path)\n else:\n os.remove(path)\n\n# Move a file or dir, replacing the destination if it exists.\n#\ndef move_file(src, dst):\n if src == dst or not os.path.isfile(src):\n return\n log.info(\"Move %s to %s\" % (src, dst))\n ensure_parent_exists(dst)\n remove_path(dst)\n shutil.move(src, dst)\n\n# Copy a file or dir, replacing the destination if it exists already.\n#\ndef copy_overwrite(src, dst):\n if src != dst:\n remove_path(dst)\n ensure_parent_exists(dst)\n shutil.copytree(src, dst, symlinks=True)\n\n# Attempt to symlink link_path -> link_to.\n# link_to must be a path relative to link_path's parent and must exist.\n# If link_path already exists, do nothing.\n#\ndef attempt_symlink(link_path, link_to):\n # Only allow linking to an existing file\n os.stat(os.path.abspath(os.path.join(link_path, \"..\", link_to)))\n\n # Only make the link if it hasn't already been made\n if not os.path.exists(link_path):\n log.info(\"Symlink %s -> %s\" % (link_path, link_to))\n os.symlink(link_to, link_path)\n\n# Takes the last entry in an array-based path and returns a normal path\n# relative to base_path.\n#\ndef top_level_file_path(base_path, path_list):\n return os.path.join(base_path, os.path.split(path_list[-1])[-1])\n\n# Takes all entries in an array-based path and returns a normal path\n# relative to base_path.\n#\ndef full_file_path(base_path, path_list):\n return os.path.join(*([base_path] + path_list))\n\n# Print a command before executing it.\n# Also print out all output from the command to STDOUT.\n#\ndef print_and_call(cmd):\n log.info(\"Cmd \" + \" \".join(cmd))\n p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n result = p.communicate()[0]\n if len(result) > 0:\n log.info(result)\n if p.returncode != 0:\n raise subprocess.CalledProcessError(p.returncode, cmd)\n\n# Special print-and-call command for the slave build that strips out\n# xcodebuild's spammy list of environment variables.\n#\ndef print_and_call_slave_build(cmd, other_platform):\n separator = '=== BUILD NATIVE TARGET '\n p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n result = p.communicate()[0].split(separator)\n if len(result) == 1:\n result = result[0]\n else:\n result = separator + result[1]\n log.info(\"Cmd \" + \" \".join(cmd) + \"\\n\" + result)\n if p.returncode != 0:\n raise subprocess.CalledProcessError(p.returncode, cmd)\n\n# Issue a warning and record that a warning has been issued.\n#\ndef issue_warning(msg, *args, **kwargs):\n global issued_warnings\n issued_warnings = True\n log.warn(msg, *args, **kwargs)\n\n\n\n##############################################################################\n#\n# Main Application\n#\n##############################################################################\n\n# Check if we are running as master.\n#\ndef is_master():\n return os.environ.get('UFW_MASTER_PLATFORM', os.environ['PLATFORM_NAME']) == os.environ['PLATFORM_NAME']\n\n# DerivedData should almost never appear in any framework, library, or header\n# search paths. However, Xcode will sometimes add them in, so we check to make\n# sure.\n#\ndef check_for_derived_data_in_search_paths(project):\n search_path_keys = [\"FRAMEWORK_SEARCH_PATHS\", \"LIBRARY_SEARCH_PATHS\", \"HEADER_SEARCH_PATHS\"]\n build_configs = project.target['buildConfigurationList']['buildConfigurations']\n build_settings = filter(lambda x: x['name'] == os.environ['CONFIGURATION'], build_configs)[0]['buildSettings']\n \n found_something = False\n for path_key in filter(lambda x: x in build_settings, search_path_keys):\n path = build_settings[path_key]\n if \"DerivedData\" in path:\n found_something = True\n log.warn(\"Derived data in %s\" % path)\n issue_warning(\"'%s' contains reference to 'DerivedData'.\" % path_key)\n if found_something:\n log.warn(\"Check your build settings and remove any entries that contain paths inside the DerivedData folder.\")\n log.warn(\"Otherwise you can disable this warning by changing 'config_warn_derived_data' in this script.\")\n\n# Link local architectures into their respective archives.\n#\ndef link_local_archs(project):\n for arch in project.local_architectures:\n print_and_call(project.get_single_arch_link_command(arch))\n\n# Link only the local architectures into the final product, not the slave\n# architectures. For iphoneos, this will be armv6, armv7. For simulator, this\n# will be i386.\n#\ndef link_combine_local_archs(project):\n print_and_call(project.get_local_archs_link_command())\n\n# Link all architectures into the final product.\n#\ndef link_combine_all_archs(project):\n print_and_call(project.get_all_archs_link_command())\n\n# Check if we should open the build directory after a successful build.\n#\ndef should_open_build_dir():\n env_setting = os.environ.get('UFW_OPEN_BUILD_DIR', None)\n if env_setting is not None:\n return env_setting\n\n return config_open_build_dir\n\n# Open the build dir in Finder.\n#\ndef open_build_dir():\n print_and_call(['open', os.environ['TARGET_BUILD_DIR']])\n\n# Check if the build was started by selecting \"Archive\" under \"Product\" in\n# Xcode.\n#\ndef is_archive_build():\n # ACTION is always 'build', but perhaps Apple will fix this someday?\n archive_build = os.environ['ACTION'] == 'archive'\n\n if not archive_build:\n # This can be passed in as an env variable when building from command line.\n archive_build = os.environ.get('UFW_ACTION', None) == 'archive'\n\n build_dir = splitpath(os.environ['BUILD_DIR'])\n if not archive_build:\n # This partial path is used when you select \"archive\" from within Xcode.\n archive_build = 'ArchiveIntermediates' in build_dir\n\n # It only counts as a full archive build if this target is being built into\n # its own build dir (not being built as a dependency of another target)\n if archive_build:\n archive_build = os.environ['TARGET_NAME'] in build_dir\n \n return archive_build\n\n# Xcode by default throws all public headers into the top level directory.\n# This function moves them to their expected deep hierarchy.\n#\ndef build_deep_header_hierarchy(project):\n header_path_top = config_deep_header_top\n if not header_path_top:\n header_path_top = os.path.commonprefix(project.header_paths)\n else:\n header_path_top = splitpath(header_path_top)\n\n built_headers_path = os.path.join(os.environ['TARGET_BUILD_DIR'], os.environ['PUBLIC_HEADERS_FOLDER_PATH'])\n movable_headers = project.movable_headers_relative_to(header_path_top)\n\n # Remove subdirs if they only contain files that have been rebuilt\n ignore_headers = filter(lambda x: not os.path.isfile(top_level_file_path(built_headers_path, x)), movable_headers)\n remove_subdirs(built_headers_path, [file[0] for file in ignore_headers])\n\n # Move rebuilt headers into their proper subdirs\n for header in movable_headers:\n move_file(top_level_file_path(built_headers_path, header), full_file_path(built_headers_path, header))\n\n# Add all symlinks needed to make a full framework structure:\n#\n# MyFramework.framework\n# |-- MyFramework -> Versions/Current/MyFramework\n# |-- Headers -> Versions/Current/Headers\n# |-- Resources -> Versions/Current/Resources\n# `-- Versions\n# |-- A\n# | |-- MyFramework\n# | |-- Headers\n# | | `-- MyFramework.h\n# | `-- Resources\n# | |-- Info.plist\n# | |-- MyViewController.nib\n# | `-- en.lproj\n# | `-- InfoPlist.strings\n# `-- Current -> A\n#\ndef add_symlinks_to_framework(project):\n base_dir = project.local_built_fw_path\n attempt_symlink(os.path.join(base_dir, \"Versions\", \"Current\"), os.environ['FRAMEWORK_VERSION'])\n if os.path.isdir(os.path.join(base_dir, \"Versions\", \"Current\", \"Headers\")):\n attempt_symlink(os.path.join(base_dir, \"Headers\"), os.path.join(\"Versions\", \"Current\", \"Headers\"))\n if os.path.isdir(os.path.join(base_dir, \"Versions\", \"Current\", \"Resources\")):\n attempt_symlink(os.path.join(base_dir, \"Resources\"), os.path.join(\"Versions\", \"Current\", \"Resources\"))\n attempt_symlink(os.path.join(base_dir, os.environ['EXECUTABLE_NAME']), os.path.join(\"Versions\", \"Current\", os.environ['EXECUTABLE_NAME']))\n\n# Build an embedded framework structure.\n# An embedded framework contains the actual framework, plus a \"Resources\"\n# directory containing symlinks to all resources found in the actual framework,\n# with the exception of \"Info.plist\" and anything ending in \".lproj\":\n#\n# MyFramework.embeddedframework\n# |-- MyFramework.framework\n# | |-- MyFramework -> Versions/Current/MyFramework\n# | |-- Headers -> Versions/Current/Headers\n# | |-- Resources -> Versions/Current/Resources\n# | `-- Versions\n# | |-- A\n# | | |-- MyFramework\n# | | |-- Headers\n# | | | `-- MyFramework.h\n# | | `-- Resources\n# | | |-- Info.plist\n# | | |-- MyViewController.nib\n# | | `-- en.lproj\n# | | `-- InfoPlist.strings\n# | `-- Current -> A\n# `-- Resources\n# `-- MyViewController.nib -> ../MyFramework.framework/Resources/MyViewController.nib\n#\ndef build_embedded_framework(project):\n fw_path = project.local_built_fw_path\n embedded_path = project.local_built_embedded_fw_path\n fw_name = os.environ['WRAPPER_NAME']\n remove_path(embedded_path)\n ensure_path_exists(embedded_path)\n copy_overwrite(fw_path, os.path.join(embedded_path, fw_name))\n ensure_path_exists(os.path.join(embedded_path, \"Resources\"))\n symlink_source = os.path.join(\"..\", fw_name, \"Resources\")\n symlink_path = os.path.join(embedded_path, \"Resources\")\n if os.path.isdir(os.path.join(fw_path, \"Resources\")):\n for file in filter(lambda x: x != \"Info.plist\" and not x.endswith(\".lproj\"), os.listdir(os.path.join(fw_path, \"Resources\"))):\n attempt_symlink(os.path.join(symlink_path, file), os.path.join(symlink_source, file))\n\n # Remove the normal framework and replace it with a symlink to the copy\n # in the embedded framework. This is needed because Xcode runs its strip\n # phase AFTER the script runs.\n embed_fw_wrapper = os.path.splitext(os.environ['WRAPPER_NAME'])[0] + \".embeddedframework\"\n remove_path(fw_path)\n attempt_symlink(fw_path, os.path.join(embed_fw_wrapper, os.environ['WRAPPER_NAME']))\n\n\n# Run the build process in slave mode to build the other configuration\n# (device/simulator).\n#\ndef run_slave_build(project):\n print_and_call_slave_build(project.get_slave_project_build_command(), project.other_platform)\n\n# Run the build process.\n#\ndef run_build():\n project = Project(os.path.join(os.environ['PROJECT_FILE_PATH'], \"project.pbxproj\"))\n\n # Issue warnings only if we're master.\n if is_master():\n if len(project.compilable_sources) == 0:\n raise Exception(\"No compilable sources found. Please add at least one source file to build target %s.\" % os.environ['TARGET_NAME'])\n\n if config_warn_derived_data:\n check_for_derived_data_in_search_paths(project)\n if config_warn_no_public_headers and len(project.public_headers) == 0:\n issue_warning('No headers in build target %s were marked public. Please move at least one header to \"Public\" in the \"Copy Headers\" build phase.' % os.environ['TARGET_NAME'])\n\n # Only build slave if this is an archive build.\n if is_archive_build():\n if is_master():\n log.debug(\"Building as MASTER\")\n # The slave-side linker tries to include this (nonexistent) path as\n # a library path.\n ensure_path_exists(project.get_slave_environment()['BUILT_PRODUCTS_DIR'])\n project.build_state.persist()\n run_slave_build(project)\n project.build_state.reload()\n else:\n log.debug(\"Building as SLAVE\")\n project.build_state.reload()\n project.build_state.set_slave_properties(project.local_architectures,\n project.local_linked_archive_paths,\n project.local_built_fw_path,\n project.local_built_embedded_fw_path)\n project.build_state.persist()\n\n link_local_archs(project)\n \n # Only do a universal binary when building an archive.\n if is_archive_build() and is_master():\n link_combine_all_archs(project)\n else:\n link_combine_local_archs(project)\n\n if config_deep_header_hierarchy:\n build_deep_header_hierarchy(project)\n\n add_symlinks_to_framework(project)\n \n if is_master():\n if config_framework_type == 'embeddedframework':\n build_embedded_framework(project)\n elif config_framework_type != 'framework':\n raise Exception(\"%s: Unknown framework type for config_framework_type\" % config_framework_type)\n\n\nif __name__ == \"__main__\":\n log_handler = logging.StreamHandler()\n log_handler.setFormatter(logging.Formatter(\"%(name)s (\" + os.environ['PLATFORM_NAME'] + \"): %(levelname)s: %(message)s\"))\n log.addHandler(log_handler)\n log.setLevel(config_log_level)\n\n error_code = 0\n prefix = \"M\" if is_master() else \"S\"\n log_handler.setFormatter(logging.Formatter(\"%(name)s (\" + prefix + \" \" + os.environ['PLATFORM_NAME'] + \"): %(levelname)s: %(message)s\"))\n\n log.debug(\"Begin build process\")\n\n if config_deep_header_top:\n config_deep_header_top = string.Template(config_deep_header_top).substitute(os.environ)\n\n try:\n run_build()\n if issued_warnings:\n if config_fail_on_warnings:\n error_code = 1\n log.warn(\"Build completed with warnings\")\n else:\n log.info(\"Build completed\")\n if not is_archive_build():\n log.info(\"Note: This is *NOT* a universal framework build. To build as a universal framework, do an archive build.\")\n log.info(\"To do an archive build from command line, use \\\"xcodebuild -configuration Release UFW_ACTION=archive clean build\\\"\")\n except Exception:\n traceback.print_exc(file=sys.stdout)\n error_code = 1\n log.error(\"Build failed\")\n finally:\n if error_code == 0 and is_archive_build() and is_master():\n log.info(\"Built framework is in \" + os.environ['TARGET_BUILD_DIR'])\n if should_open_build_dir():\n open_build_dir()\n sys.exit(error_code)\n"; 499 | }; 500 | /* End PBXShellScriptBuildPhase section */ 501 | 502 | /* Begin PBXSourcesBuildPhase section */ 503 | 87D8E49E182156D300546E6D /* Sources */ = { 504 | isa = PBXSourcesBuildPhase; 505 | buildActionMask = 2147483647; 506 | files = ( 507 | 87D8E51C1821577E00546E6D /* Reachability.m in Sources */, 508 | 87D8E5091821577E00546E6D /* ALMemory.m in Sources */, 509 | 87D8E4FD1821577E00546E6D /* ALBattery.m in Sources */, 510 | 87D8E5071821577E00546E6D /* ALLocalization.m in Sources */, 511 | 87D8E5051821577E00546E6D /* ALJailbreak.m in Sources */, 512 | 87D8E5031821577E00546E6D /* ALHardware.m in Sources */, 513 | 87D8E5011821577E00546E6D /* ALDisk.m in Sources */, 514 | 87D8E50D1821577E00546E6D /* ALProcessor.m in Sources */, 515 | 87D8E50B1821577E00546E6D /* ALNetwork.m in Sources */, 516 | 87D8E4FB1821577E00546E6D /* ALAccessory.m in Sources */, 517 | 87D8E4FF1821577E00546E6D /* ALCarrier.m in Sources */, 518 | 0449A8C1183A019800970366 /* ALSystem.m in Sources */, 519 | ); 520 | runOnlyForDeploymentPostprocessing = 0; 521 | }; 522 | /* End PBXSourcesBuildPhase section */ 523 | 524 | /* Begin PBXVariantGroup section */ 525 | 87D8E4A9182156D300546E6D /* InfoPlist.strings */ = { 526 | isa = PBXVariantGroup; 527 | children = ( 528 | 87D8E4AA182156D300546E6D /* en */, 529 | ); 530 | name = InfoPlist.strings; 531 | sourceTree = ""; 532 | }; 533 | /* End PBXVariantGroup section */ 534 | 535 | /* Begin XCBuildConfiguration section */ 536 | 87D8E4B0182156D300546E6D /* Debug */ = { 537 | isa = XCBuildConfiguration; 538 | buildSettings = { 539 | ALWAYS_SEARCH_USER_PATHS = NO; 540 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 541 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 542 | CLANG_CXX_LIBRARY = "libc++"; 543 | CLANG_ENABLE_MODULES = YES; 544 | CLANG_ENABLE_OBJC_ARC = YES; 545 | CLANG_WARN_BOOL_CONVERSION = YES; 546 | CLANG_WARN_CONSTANT_CONVERSION = YES; 547 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 548 | CLANG_WARN_EMPTY_BODY = YES; 549 | CLANG_WARN_ENUM_CONVERSION = YES; 550 | CLANG_WARN_INT_CONVERSION = YES; 551 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 552 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 553 | COPY_PHASE_STRIP = NO; 554 | GCC_C_LANGUAGE_STANDARD = gnu99; 555 | GCC_DYNAMIC_NO_PIC = NO; 556 | GCC_OPTIMIZATION_LEVEL = 0; 557 | GCC_PREPROCESSOR_DEFINITIONS = ( 558 | "DEBUG=1", 559 | "$(inherited)", 560 | ); 561 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 562 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 563 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 564 | GCC_WARN_UNDECLARED_SELECTOR = YES; 565 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 566 | GCC_WARN_UNUSED_FUNCTION = YES; 567 | GCC_WARN_UNUSED_VARIABLE = YES; 568 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 569 | ONLY_ACTIVE_ARCH = YES; 570 | SDKROOT = iphoneos; 571 | }; 572 | name = Debug; 573 | }; 574 | 87D8E4B1182156D300546E6D /* Release */ = { 575 | isa = XCBuildConfiguration; 576 | buildSettings = { 577 | ALWAYS_SEARCH_USER_PATHS = NO; 578 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 579 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 580 | CLANG_CXX_LIBRARY = "libc++"; 581 | CLANG_ENABLE_MODULES = YES; 582 | CLANG_ENABLE_OBJC_ARC = YES; 583 | CLANG_WARN_BOOL_CONVERSION = YES; 584 | CLANG_WARN_CONSTANT_CONVERSION = YES; 585 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 586 | CLANG_WARN_EMPTY_BODY = YES; 587 | CLANG_WARN_ENUM_CONVERSION = YES; 588 | CLANG_WARN_INT_CONVERSION = YES; 589 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 590 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 591 | COPY_PHASE_STRIP = YES; 592 | ENABLE_NS_ASSERTIONS = NO; 593 | GCC_C_LANGUAGE_STANDARD = gnu99; 594 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 595 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 596 | GCC_WARN_UNDECLARED_SELECTOR = YES; 597 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 598 | GCC_WARN_UNUSED_FUNCTION = YES; 599 | GCC_WARN_UNUSED_VARIABLE = YES; 600 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 601 | SDKROOT = iphoneos; 602 | VALIDATE_PRODUCT = YES; 603 | }; 604 | name = Release; 605 | }; 606 | 87D8E4B3182156D300546E6D /* Debug */ = { 607 | isa = XCBuildConfiguration; 608 | buildSettings = { 609 | ARCHS = ( 610 | armv6, 611 | "$(ARCHS_STANDARD_32_BIT)", 612 | ); 613 | CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)/Versions/$(FRAMEWORK_VERSION)"; 614 | DEAD_CODE_STRIPPING = NO; 615 | DYLIB_COMPATIBILITY_VERSION = 1; 616 | DYLIB_CURRENT_VERSION = 1; 617 | FRAMEWORK_VERSION = A; 618 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 619 | GCC_PREFIX_HEADER = "ALSystemUtilities/ALSystemUtilities-Prefix.pch"; 620 | INFOPLIST_FILE = "ALSystemUtilities/ALSystemUtilities-Info.plist"; 621 | INFOPLIST_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Info.plist"; 622 | INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; 623 | LINK_WITH_STANDARD_LIBRARIES = NO; 624 | MACH_O_TYPE = mh_object; 625 | PRODUCT_NAME = "$(TARGET_NAME)"; 626 | SKIP_INSTALL = YES; 627 | UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Resources"; 628 | WRAPPER_EXTENSION = framework; 629 | }; 630 | name = Debug; 631 | }; 632 | 87D8E4B4182156D300546E6D /* Release */ = { 633 | isa = XCBuildConfiguration; 634 | buildSettings = { 635 | ARCHS = ( 636 | armv6, 637 | "$(ARCHS_STANDARD_32_BIT)", 638 | ); 639 | CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)/Versions/$(FRAMEWORK_VERSION)"; 640 | DEAD_CODE_STRIPPING = NO; 641 | DYLIB_COMPATIBILITY_VERSION = 1; 642 | DYLIB_CURRENT_VERSION = 1; 643 | FRAMEWORK_VERSION = A; 644 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 645 | GCC_PREFIX_HEADER = "ALSystemUtilities/ALSystemUtilities-Prefix.pch"; 646 | INFOPLIST_FILE = "ALSystemUtilities/ALSystemUtilities-Info.plist"; 647 | INFOPLIST_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Info.plist"; 648 | INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; 649 | LINK_WITH_STANDARD_LIBRARIES = NO; 650 | MACH_O_TYPE = mh_object; 651 | PRODUCT_NAME = "$(TARGET_NAME)"; 652 | SKIP_INSTALL = YES; 653 | UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Resources"; 654 | WRAPPER_EXTENSION = framework; 655 | }; 656 | name = Release; 657 | }; 658 | /* End XCBuildConfiguration section */ 659 | 660 | /* Begin XCConfigurationList section */ 661 | 87D8E49D182156D300546E6D /* Build configuration list for PBXProject "ALSystemUtilities" */ = { 662 | isa = XCConfigurationList; 663 | buildConfigurations = ( 664 | 87D8E4B0182156D300546E6D /* Debug */, 665 | 87D8E4B1182156D300546E6D /* Release */, 666 | ); 667 | defaultConfigurationIsVisible = 0; 668 | defaultConfigurationName = Release; 669 | }; 670 | 87D8E4B2182156D300546E6D /* Build configuration list for PBXNativeTarget "ALSystemUtilities" */ = { 671 | isa = XCConfigurationList; 672 | buildConfigurations = ( 673 | 87D8E4B3182156D300546E6D /* Debug */, 674 | 87D8E4B4182156D300546E6D /* Release */, 675 | ); 676 | defaultConfigurationIsVisible = 0; 677 | defaultConfigurationName = Release; 678 | }; 679 | /* End XCConfigurationList section */ 680 | }; 681 | rootObject = 87D8E49A182156D300546E6D /* Project object */; 682 | } 683 | --------------------------------------------------------------------------------