Check if NSDictionary is empty

后端 未结 8 952
名媛妹妹
名媛妹妹 2021-02-13 02:40

I want to check if an NSDictionary is empty. I am doing it like this.

  mutDictValues = [[[NSUserDefaults standardUserDefaults] objectForKey:@\"dicV         


        
8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 03:21

    try this code

    NSMutableDictionary *dict = ...
    
    BOOL isEmpty = ([dict count] == 0);
    

提交回复
热议问题