Open Platform
Skip to content

Init lock ​

Diagrammatic drawing

img

Code ​
c
NSMutableDictionary *dict = @{}.mutableCopy;
    dict[@"lockMac"] = scanModel.lockMac;
    dict[@"lockName"] = scanModel.lockName;
    dict[@"lockVersion"] = scanModel.lockVersion;
 
// Only hotel lock need to be set
//    dict[@"hotelInfo"] = @"xxxx";
//    dict[@"buildingNumber"] = @10;
//    dict[@"floorNumber"] = @3;
 
    [TTLock initLockWithDict:dict success:^(NSString *lockData, long long specialValue) {
        //Init lock success , then upload lockData
 
        /* 
        [Network uploadLockData:lockData success:^(){
            NSLog(@"##############  Upload lockData success  ##############");
        } failure:^(NSError *error){
           //You should reset the lock after upload lockData failed, otherwise the lock can't be initialized again
            [TTLock resetLockWithLockData:success:failure:];
        }];
       */
    } failure:^(TTError errorCode, NSString *errorMsg) {
        NSLog(@"##############  error: %@  ##############",errorMsg);
    }];
CopyRight © 2012-2026 TTLock.All Rights Reserved