0

我收到此错误:::[__NSCFDictionary setObject:forKey:]: attempt to insert nil key'

我检查了我的对象是否已正确初始化,但仍然出现此错误。使用云矿。

(void)addInventory:(Inventory *)inventory {

    [_inventoryList addObject:inventory];

    [inventory save:^(CMObjectUploadResponse *response) {
        NSLog(@"status: %@", [response.uploadStatuses objectForKey:inventory.objectId]);

        if (![[response.uploadStatuses objectForKey:inventory.objectId] isEqualToString:@"created"]) {
            // Alert the user
            NSString *message = @"The item could not be created.";
            if (response.error)
                message = [response.error localizedDescription];
            UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:[response.error localizedDescription] delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
            [errorAlert show];
        }

    }];
4

0 回答 0