4

Here is my data structure

On the top I have a company id and then I have client id and then I have time stamp and then I have data , so I want to check if this company id is present i want to add new client under this company if company id is not present I want to add new node with like above image. what I am doing here Its add a new node every time

LoginResponse *loginResponseObj = [Utililities loadLoginResponseObjectWithKey:LOGIN_RESPONSE_KEY_FOR_USERDEFAULT];
NSMutableDictionary *dataDict = [NSMutableDictionary dictionary];
[dataDict setValue:[NSNumber numberWithFloat:[LocationManager sharedManager].location.coordinate.latitude] forKey:@"lat"];
[dataDict setValue:[NSNumber numberWithFloat:[LocationManager sharedManager].location.coordinate.latitude] forKey:@"lng"];

NSMutableDictionary *timeStampDict = [NSMutableDictionary dictionary];
NSTimeInterval timeInSeconds = [[NSDate date] timeIntervalSince1970];
[timeStampDict setValue:dataDict forKey:[NSString stringWithFormat:@"%.0f",timeInSeconds]];
NSMutableDictionary *fcmDict = [NSMutableDictionary dictionary];
[fcmDict setValue:timeStampDict forKey:loginResponseObj.workerInfo.fcmId];

NSMutableDictionary *companyDict = [NSMutableDictionary dictionary];
[companyDict setValue:fcmDict forKey:[NSString stringWithFormat:@"%.0f",loginResponseObj.workerInfo.companyId]];

[[self.ref child:[NSString stringWithFormat:@"%.0f",loginResponseObj.workerInfo.companyId]]setValue:companyDict];
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Matloob Hasnain
  • 1,025
  • 6
  • 21

2 Answers2

3

I had similar issue and found in project code like:

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];

I just removed it.

Yaroslav Babenko
  • 234
  • 3
  • 13
0

Looks like issue is mostly when back button title is set to different offset..

Change the way of hiding title of navigation back button using below logic:-

if(@available(iOS 11, *)) {
   [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor clearColor]} forState:UIControlStateNormal];
   [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor clearColor]} forState:UIControlStateHighlighted];

} else {
   [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-60, -60) forBarMetrics:UIBarMetricsDefault];
}

Found answer from this post

Community
  • 1
  • 1
Chandan
  • 500
  • 3
  • 10