| > * iOS 8.0 and above. | > * iOS 8.0 and above. | ||||
| > * The Bluetooth version used by the device requires 4.0 and above. | > * The Bluetooth version used by the device requires 4.0 and above. | ||||
| > * Need to add iFreshSDK.framework package dependency; | > * Need to add iFreshSDK.framework package dependency; | ||||
| > * Apply for the key and secret of sdk, application address: http://sdk.aicare.net.cn | |||||
| ## The document description | ## The document description | ||||
| 1.iFreshSDK.framework (package name raytao.pingwang.iFreshDemo); | 1.iFreshSDK.framework (package name raytao.pingwang.iFreshDemo); | ||||
| 2.Add the following code to AppDelegate: | |||||
| ``` | |||||
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |||||
| // Override point for customization after application launch. | |||||
| [iFreshSDK setAppKey:@"key" appSecret:@"secret"]; | |||||
| return YES; | |||||
| } | |||||
| ``` | |||||
| ## The version update information | ## The version update information | ||||
| For details, please see the "Good Nutrition SDK Release Notes.doc" document. | For details, please see the "Good Nutrition SDK Release Notes.doc" document. | ||||
| > * iOS 8.0及以上版本。 | > * iOS 8.0及以上版本。 | ||||
| > * 设备所使用蓝牙版本需要4.0及以上。 | > * 设备所使用蓝牙版本需要4.0及以上。 | ||||
| > * 需添加iFreshSDK.framework包依赖; | > * 需添加iFreshSDK.framework包依赖; | ||||
| > * 申请sdk的key和secret,申请地址:http://sdk.aicare.net.cn | |||||
| ## 文件说明: | ## 文件说明: | ||||
| 1. iFreshSDK.framework(包名raytao.pingwang.iFreshDemo) | 1. iFreshSDK.framework(包名raytao.pingwang.iFreshDemo) | ||||
| 2. 在AppDelegate中加入如下代码: | |||||
| ``` | |||||
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |||||
| // Override point for customization after application launch. | |||||
| [iFreshSDK setAppKey:@"key" appSecret:@"secret"]; | |||||
| return YES; | |||||
| } | |||||
| ``` | |||||
| ## 版本更新信息 | ## 版本更新信息 | ||||
| 详情请见“好营养SDK发布说明.doc”文档 | 详情请见“好营养SDK发布说明.doc”文档 |
| 1F4E2E411DA8C7F800253C00 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1F4E2E3F1DA8C7F800253C00 /* Main.storyboard */; }; | 1F4E2E411DA8C7F800253C00 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1F4E2E3F1DA8C7F800253C00 /* Main.storyboard */; }; | ||||
| 1F4E2E431DA8C7F800253C00 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1F4E2E421DA8C7F800253C00 /* Assets.xcassets */; }; | 1F4E2E431DA8C7F800253C00 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1F4E2E421DA8C7F800253C00 /* Assets.xcassets */; }; | ||||
| 1F4E2E461DA8C7F800253C00 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1F4E2E441DA8C7F800253C00 /* LaunchScreen.storyboard */; }; | 1F4E2E461DA8C7F800253C00 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1F4E2E441DA8C7F800253C00 /* LaunchScreen.storyboard */; }; | ||||
| E64A7F0024405DE000D22B84 /* iFreshSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E64A7EFF24405DE000D22B84 /* iFreshSDK.framework */; }; | |||||
| E633F4E5255BD65800EE5A95 /* iFreshSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E633F4E4255BD65800EE5A95 /* iFreshSDK.framework */; }; | |||||
| /* End PBXBuildFile section */ | /* End PBXBuildFile section */ | ||||
| /* Begin PBXFileReference section */ | /* Begin PBXFileReference section */ | ||||
| 1F4E2E421DA8C7F800253C00 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | 1F4E2E421DA8C7F800253C00 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | ||||
| 1F4E2E451DA8C7F800253C00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | 1F4E2E451DA8C7F800253C00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | ||||
| 1F4E2E471DA8C7F800253C00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | 1F4E2E471DA8C7F800253C00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | ||||
| E64A7EFF24405DE000D22B84 /* iFreshSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = iFreshSDK.framework; sourceTree = "<group>"; }; | |||||
| E633F4E4255BD65800EE5A95 /* iFreshSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = iFreshSDK.framework; sourceTree = "<group>"; }; | |||||
| /* End PBXFileReference section */ | /* End PBXFileReference section */ | ||||
| /* Begin PBXFrameworksBuildPhase section */ | /* Begin PBXFrameworksBuildPhase section */ | ||||
| isa = PBXFrameworksBuildPhase; | isa = PBXFrameworksBuildPhase; | ||||
| buildActionMask = 2147483647; | buildActionMask = 2147483647; | ||||
| files = ( | files = ( | ||||
| E64A7F0024405DE000D22B84 /* iFreshSDK.framework in Frameworks */, | |||||
| E633F4E5255BD65800EE5A95 /* iFreshSDK.framework in Frameworks */, | |||||
| ); | ); | ||||
| runOnlyForDeploymentPostprocessing = 0; | runOnlyForDeploymentPostprocessing = 0; | ||||
| }; | }; | ||||
| 1F4E2E351DA8C7F800253C00 /* iFreshDemo */ = { | 1F4E2E351DA8C7F800253C00 /* iFreshDemo */ = { | ||||
| isa = PBXGroup; | isa = PBXGroup; | ||||
| children = ( | children = ( | ||||
| E64A7EFF24405DE000D22B84 /* iFreshSDK.framework */, | |||||
| E633F4E4255BD65800EE5A95 /* iFreshSDK.framework */, | |||||
| 1F4E2E391DA8C7F800253C00 /* AppDelegate.h */, | 1F4E2E391DA8C7F800253C00 /* AppDelegate.h */, | ||||
| 1F4E2E3A1DA8C7F800253C00 /* AppDelegate.m */, | 1F4E2E3A1DA8C7F800253C00 /* AppDelegate.m */, | ||||
| 1F4E2E3C1DA8C7F800253C00 /* ViewController.h */, | 1F4E2E3C1DA8C7F800253C00 /* ViewController.h */, | ||||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||
| CODE_SIGN_IDENTITY = "iPhone Developer"; | CODE_SIGN_IDENTITY = "iPhone Developer"; | ||||
| "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||||
| CURRENT_PROJECT_VERSION = 202011111625; | |||||
| DEVELOPMENT_TEAM = YEU77XR292; | DEVELOPMENT_TEAM = YEU77XR292; | ||||
| FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
| "$(inherited)", | "$(inherited)", | ||||
| "$(PROJECT_DIR)/iFreshSDK", | "$(PROJECT_DIR)/iFreshSDK", | ||||
| "$(PROJECT_DIR)/libiFreshSDK", | "$(PROJECT_DIR)/libiFreshSDK", | ||||
| ); | ); | ||||
| MARKETING_VERSION = 1.1.8; | |||||
| PRODUCT_BUNDLE_IDENTIFIER = raytao.pingwang.iFreshDemo; | PRODUCT_BUNDLE_IDENTIFIER = raytao.pingwang.iFreshDemo; | ||||
| PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
| PROVISIONING_PROFILE = ""; | PROVISIONING_PROFILE = ""; | ||||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||
| CODE_SIGN_IDENTITY = "iPhone Developer"; | CODE_SIGN_IDENTITY = "iPhone Developer"; | ||||
| "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||||
| CURRENT_PROJECT_VERSION = 202011111625; | |||||
| DEVELOPMENT_TEAM = YEU77XR292; | DEVELOPMENT_TEAM = YEU77XR292; | ||||
| FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
| "$(inherited)", | "$(inherited)", | ||||
| "$(PROJECT_DIR)/iFreshSDK", | "$(PROJECT_DIR)/iFreshSDK", | ||||
| "$(PROJECT_DIR)/libiFreshSDK", | "$(PROJECT_DIR)/libiFreshSDK", | ||||
| ); | ); | ||||
| MARKETING_VERSION = 1.1.8; | |||||
| PRODUCT_BUNDLE_IDENTIFIER = raytao.pingwang.iFreshDemo; | PRODUCT_BUNDLE_IDENTIFIER = raytao.pingwang.iFreshDemo; | ||||
| PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
| PROVISIONING_PROFILE = ""; | PROVISIONING_PROFILE = ""; |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||||
| // Override point for customization after application launch. | // Override point for customization after application launch. | ||||
| [iFreshSDK setAppKey:@"83d29ded03f2644d" appSecret:@"00a2008abda8e1f1a2e8bd4f5e"]; | |||||
| // [iFreshSDK setAppKey:@"83d29ded03f2644d" appSecret:@"00a2008abda8e1f1a2e8bd4f5e"]; | |||||
| return YES; | return YES; | ||||
| } | } | ||||
| <key>CFBundlePackageType</key> | <key>CFBundlePackageType</key> | ||||
| <string>APPL</string> | <string>APPL</string> | ||||
| <key>CFBundleShortVersionString</key> | <key>CFBundleShortVersionString</key> | ||||
| <string>1.1.7</string> | |||||
| <string>$(MARKETING_VERSION)</string> | |||||
| <key>CFBundleSignature</key> | <key>CFBundleSignature</key> | ||||
| <string>????</string> | <string>????</string> | ||||
| <key>CFBundleVersion</key> | <key>CFBundleVersion</key> | ||||
| <string>201904191155</string> | |||||
| <string>$(CURRENT_PROJECT_VERSION)</string> | |||||
| <key>LSRequiresIPhoneOS</key> | <key>LSRequiresIPhoneOS</key> | ||||
| <true/> | <true/> | ||||
| <key>NSAppTransportSecurity</key> | <key>NSAppTransportSecurity</key> |
| - (void)viewDidLoad { | - (void)viewDidLoad { | ||||
| [super viewDidLoad]; | [super viewDidLoad]; | ||||
| self.unitArray = @[@"g",@"ml",@"lb",@"oz",@"kg",@"斤"]; | |||||
| self.unitArray = @[@"g",@"ml",@"lb:oz",@"oz",@"kg",@"斤",@"lb"]; | |||||
| [[iFreshSDK shareManager] setbleReturnValueDelegate:self]; | [[iFreshSDK shareManager] setbleReturnValueDelegate:self]; | ||||
| [[iFreshSDK shareManager] bleDoScan]; | [[iFreshSDK shareManager] bleDoScan]; | ||||
| _bleStatus.adjustsFontSizeToFitWidth = YES; | _bleStatus.adjustsFontSizeToFitWidth = YES; | ||||
| [[iFreshSDK shareManager] insertTheUnit:(UNIT_ml)]; | [[iFreshSDK shareManager] insertTheUnit:(UNIT_ml)]; | ||||
| }]; | }]; | ||||
| [contrl addAction:action2]; | [contrl addAction:action2]; | ||||
| UIAlertAction * action3 = [UIAlertAction actionWithTitle:@"lb" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { | |||||
| UIAlertAction * action3 = [UIAlertAction actionWithTitle:@"lb:oz" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { | |||||
| [[iFreshSDK shareManager] insertTheUnit:(UNIT_lb)]; | [[iFreshSDK shareManager] insertTheUnit:(UNIT_lb)]; | ||||
| }]; | }]; | ||||
| [contrl addAction:action3]; | [contrl addAction:action3]; | ||||
| [[iFreshSDK shareManager] insertTheUnit:(UNIT_jin)]; | [[iFreshSDK shareManager] insertTheUnit:(UNIT_jin)]; | ||||
| }]; | }]; | ||||
| [contrl addAction:action6]; | [contrl addAction:action6]; | ||||
| UIAlertAction * actionLB = [UIAlertAction actionWithTitle:@"lb" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { | |||||
| [[iFreshSDK shareManager] insertTheUnit:(UNIT_LB)]; | |||||
| }]; | |||||
| [contrl addAction:actionLB]; | |||||
| UIAlertAction * action7 = [UIAlertAction actionWithTitle:@"Cancel" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) { | UIAlertAction * action7 = [UIAlertAction actionWithTitle:@"Cancel" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) { | ||||
| }]; | }]; | ||||
| }else if (unitChange == UNIT_jin){ | }else if (unitChange == UNIT_jin){ | ||||
| unit = _unitArray[5]; | unit = _unitArray[5]; | ||||
| _unitLabel.text = _unitArray[5]; | _unitLabel.text = _unitArray[5]; | ||||
| }else if (unitChange == UNIT_LB){ | |||||
| unit = _unitArray[6]; | |||||
| _unitLabel.text = _unitArray[6]; | |||||
| } | } | ||||
| //Get the current unit here | //Get the current unit here | ||||
| _unitLabel.text = _unitArray[5] ; | _unitLabel.text = _unitArray[5] ; | ||||
| unit = _unitArray[5]; | unit = _unitArray[5]; | ||||
| [[iFreshSDK shareManager] insertTheUnit:UNIT_jin]; | [[iFreshSDK shareManager] insertTheUnit:UNIT_jin]; | ||||
| }else if (indexPath.row == 6) { | |||||
| _unitLabel.text = _unitArray[6] ; | |||||
| unit = _unitArray[6]; | |||||
| [[iFreshSDK shareManager] insertTheUnit:UNIT_LB]; | |||||
| } | } | ||||
| [ud_Unit setObject:unit forKey:@"unitUnit"]; | [ud_Unit setObject:unit forKey:@"unitUnit"]; |
| * weightvalue:Incoming weight string in kg | * weightvalue:Incoming weight string in kg | ||||
| */ | */ | ||||
| + (NSString *)kgTolb:(NSString *)weightValue; | + (NSString *)kgTolb:(NSString *)weightValue; | ||||
| + (NSString *)LBTog:(NSString *)weightValue; | |||||
| + (NSString *)gToLB:(NSString *)weightVlaue; | |||||
| @end | @end |
| typedef enum : NSUInteger { | typedef enum : NSUInteger { | ||||
| UNIT_g = 0, | |||||
| UNIT_ml, | |||||
| UNIT_lb, | |||||
| UNIT_oz, | |||||
| UNIT_kg, | |||||
| UNIT_jin | |||||
| UNIT_g = 0, //g | |||||
| UNIT_ml = 1, // | |||||
| UNIT_lb = 2, //lb:oz | |||||
| UNIT_oz = 3, //oz | |||||
| UNIT_kg = 4, //kg | |||||
| UNIT_jin = 5, //斤 | |||||
| UNIT_LB = 10,//lb | |||||
| } GN_UnitEnum; | } GN_UnitEnum; | ||||