megahealth / megaring-oc

MegaRing SDK & Demo for iOS in Objective-C
2 stars 1 forks source link

Error When Calling parseBPData #2

Open jayfar opened 2 years ago

jayfar commented 2 years ago

When I call parseBPData, I am getting the following error:

The operation couldn’t be completed. (NSMRSDkErrorDomain error 2.)

I only see this error in my code and not in your sample code. I must be missing something or setting something up incorrectly. I carefully compared your sample code here with my code and the input parameters are very similar.

Here is my code with a few additional NSLog statements:

      NSLog(@"Current Data: ");
      [self logNSData:_data];
      NSLog(@"RRR before parseBPData  _caliSBP:%d _caliDBP:%d time:%d, _data Length:%d", _caliSBP, _caliDBP, time, (int)_data.length);

      [MRApi parseBPData:_data time:time caliSBP:_caliSBP caliDBP:_caliDBP block:^(MRBPReport *report, NSError *error) {

        if(error != NULL) {
          NSLog(@"RRR  error => %@ ", [error localizedDescription] );
          // I am getting this error here: error => The operation couldn’t be completed. (NSMRSDkErrorDomain error 2.)
        }

Here is my code output:

2022-09-18 13:19:03.338846-0400l[2064:8562552] Current Data:
2022-09-18 13:19:03.351066-0400 [2064:8562552] 60010000537c0a0103c411c12c0127a6120a91012bf71503ce012c06178601012bba19b300012b5b1b9cae012b371d50b0012ae61edf97012a7d1fff19012a391fff190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060010000537d0a012a371fff19012a3b1fff19012a331fff190129f11fff190129f91fff19012a131fff19012aea1fff19012a661fff19012a3d1fff19012a7f1fff190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060010000537e0a012aef1fff19012b2c1fff19012b351fff19012af71fff19012b371fff19012b551fff19012b641fff19012bd91fff19012b461fff19012b5d1fff1900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000... <Rest of the data not pasted>
2022-09-18 13:19:03.352424-0400 [2064:8562552] RRR before parseBPData  _caliSBP:120 _caliDBP:70 time:1319, _data Length:3640
###QMRLog-------[2022-09-18 13:19:03.353] +[MRApi parseBPData:time:caliSBP:caliDBP:block:]_block_invoke-252 parseBPData:--verifySDk------valid---0--error-------Error Domain=NSMRSDkErrorDomain Code=2 "(null)"
2022-09-18 13:19:03.356629-0400 [2064:8562552] RRR  error => The operation couldn’t be completed. (NSMRSDkErrorDomain error 2.)

Can you help me identify what the NSMRSDkErrorDomain error 2 means?

macflyang commented 2 years ago

Hi, Jayfar!

 When parsing the data of the ring, call:+[MRApi parseMonitorData: completion:] and

+[MRApi parseBPData: time: caliSBP: caliDBP: block:] The method also needs to verify the AppKey and AppID (that is, the bound BundleId) through the network, otherwise an error will occur when parsing data.

 1. Please check whether the AppKey, AppId and BundleID of your running project are correct or whether the network is normal when collecting data
  1. If you don't have an AppKey..., please send me your BundleID or email: caifei@megahealth.cn , I will send you the AppKey and AppId.

    As follows: Our------ // BundleId:com.megahealth.MegaRingBLE [MRApi setUpWithAppId:@"D4CE5DD515F81247" appKey:@"uedQ2MgVEFlsGIWSgofHYHNdZSyHmmJ5" completion:^(BOOL isValid, NSError *error) { //isValid == 1 --- valid; 0 --- invalid

    NSLog(@"isValid-----------%d-------error-------%ld",isValid,(long)error.code);

    }];

Best wishes~