objective c - queryordered - 如果不存在,則推入Firebase中的新節點




swift firebase教學 (2)

看起來問題大多是當後退按鈕標題設置為不同的偏移量時

使用下面的邏輯改變導航後退按鈕的標題的方式: -

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];
}

找到了這個職位的答案

在頂部我有一個company id ,然後我有client id ,然後我有time stamp ,然後我有數據,所以我想檢查,如果這個公司ID是目前我想添加新的客戶端下這家公司,如果公司ID是不存在我要添加像上面的圖像的新節點。 我在這裡做什麼它每次都添加一個新的節點

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];

我有類似的問題,並找到像項目代碼:

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

我剛剛刪除它。





firebase-database