TXCommonUtils.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // TXCommonUtils.h
  3. // authsdk
  4. //
  5. // Created by yangli on 12/03/2018.
  6. #import <Foundation/Foundation.h>
  7. @interface TXCommonUtils : NSObject
  8. /**
  9. 判断当前设备蜂窝数据网络是否开启,即3G/4G
  10. @return 结果
  11. */
  12. + (BOOL)checkDeviceCellularDataEnable;
  13. /**
  14. 判断当前上网卡运营商是否是中国联通
  15. @return 结果
  16. */
  17. + (BOOL)isChinaUnicom;
  18. /**
  19. 判断当前上网卡运营商是否是中国移动
  20. @return 结果
  21. */
  22. + (BOOL)isChinaMobile;
  23. /**
  24. 判断当前上网卡运营商是否是中国电信
  25. @return 结果
  26. */
  27. + (BOOL)isChinaTelecom;
  28. /**
  29. 获取当前上网卡运营商名称,比如中国移动、中国电信、中国联通
  30. @return 结果
  31. */
  32. + (NSString *)getCurrentCarrierName;
  33. /**
  34. 获取当前上网卡网络类型,比如WiFi,4G
  35. @return 结果
  36. */
  37. + (NSString *)getNetworktype;
  38. /**
  39. 判断当前设备是否有SIM卡
  40. @return 结果
  41. */
  42. + (BOOL)simSupportedIsOK;
  43. /**
  44. 判断wwan是否开着(通过p0网卡判断,无wifi或有wifi情况下都能检测到)
  45. @return 结果
  46. */
  47. + (BOOL)isWWANOpen;
  48. /**
  49. 判断wwan是否开着(仅无wifi情况下)
  50. @return 结果
  51. */
  52. + (BOOL)reachableViaWWAN;
  53. /**
  54. 获取设备当前网络私网IP地址
  55. @return 结果
  56. */
  57. + (NSString *)getMobilePrivateIPAddress:(BOOL)preferIPv4;
  58. /**
  59. 获取当前设备的唯一标识ID
  60. */
  61. + (NSString *)getUniqueID;
  62. /**
  63. 通过颜色设置生成图片,支持弧度设置,比如一键登录按钮背景图片
  64. */
  65. + (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size isRoundedCorner:(BOOL )isRounded radius:(CGFloat)radius;
  66. @end