Просмотр исходного кода

1.修改iOS UWA字典创建时空对象引起崩溃。

Pen Li 7 лет назад
Родитель
Сommit
4220fa9b01

+ 2 - 2
RedAnt ERP Mobile/common/CommonEditor/EnumSelectAndSort/EnumSelectAndSortViewController.m

@@ -121,8 +121,8 @@
         EnumModel *model = [_arrayDataSource objectAtIndex:i];
         NSDictionary *val_json = @{
                                    @"check": @(model.check),
-                                   @"value": model.value,
-                                   @"value_id": model.value_id
+                                   @"value": model.value != nil ? model.value : @"",
+                                   @"value_id": model.value_id != nil ? model.value_id : @""
                                    };
         NSString *key = [NSString stringWithFormat:@"val_%d",i];
         [dic setObject:val_json forKey:key];

+ 8 - 2
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -11995,7 +11995,9 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
             
         }];
     }
-    
+    if (!orderCode) {
+        orderCode = @"";
+    }
     NSDictionary *newParams = @{
                                 @"product_id" : product_id_string,
                                 @"orderCode"  : orderCode
@@ -12171,9 +12173,13 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
         qty = [qty substringFromIndex:1];
     }
     
+    NSString *orderCode = params[@"orderCode"];
+    if (!orderCode) {
+        orderCode = @"";
+    }
     NSDictionary *newParams = @{
                                 @"product_id" : product_id,
-                                @"orderCode"  : params[@"orderCode"],
+                                @"orderCode"  : orderCode,
                                 @"qty"        : qty
                                 };
     

+ 2 - 2
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -436,7 +436,7 @@
         {
             NSMutableDictionary* params = [@{
                                             @"thumb" : @"1",
-                                            @"order_code" : self.order_code,
+                                            @"order_code" : self.order_code != nil ? self.order_code : @"",
                                             } mutableCopy];
             NSData *dicData = [OLDataProvider  offline_request_salesorder:params];
             NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:dicData options:NSJSONReadingMutableContainers error:nil];
@@ -479,7 +479,7 @@
         {
             NSMutableDictionary* params = [@{
                                              @"thumb" : @"0",
-                                             @"order_code" : self.order_code,
+                                             @"order_code" : self.order_code != nil ? self.order_code : @"",
                                              } mutableCopy];
             NSData *dicData = [OLDataProvider  offline_request_salesorder:params];
             NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:dicData options:NSJSONReadingMutableContainers error:nil];

+ 14 - 0
RedAnt ERP Mobile/common/Singleton.m

@@ -42,4 +42,18 @@
     self.currentOrderIsMerged = NO;
 }
 
+- (NSString *)homeClickedItemName {
+    if (!_homeClickedItemName) {
+        _homeClickedItemName = @"";
+    }
+    return _homeClickedItemName;
+}
+
+- (NSString *)deliveryString {
+    if (!_deliveryString) {
+        _deliveryString = @"";
+    }
+    return _deliveryString;
+}
+
 @end

+ 3 - 0
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -2194,6 +2194,9 @@ repeat:
     
     [params setObject:screenName forKey:kScreenName];
     [params setObject:@"Add To Cart" forKey:kAction];
+    if (!model_name) {
+        model_name = @"";
+    }
     [params setObject:@{@"ModelName" : model_name} forKey:kExtra];
     
     NSDictionary* customerinfo= appDelegate.customerInfo;

+ 3 - 0
RedAnt ERP Mobile/common/sort/SortButton.m

@@ -56,6 +56,9 @@
 }
 
 -(CGSize)string:(NSString *)string sizeWithSize:(CGSize)size font:(UIFont *)font{
+    if (!font) {
+        font = [UIFont systemFontOfSize:15.0f];
+    }
     NSDictionary *attribute = @{NSFontAttributeName: font};
     
     CGSize resSize = [string boundingRectWithSize:size