1

Everything is OK but it's NOT on iOS 7.1.1

I don't know why. My objects I try to save are NSString or NSNumber (I checked each objects)

Someone help me please!

Attempt to set a non-property-list object (
        {
        channel = "No Channel";
        channelId = "";
    },
        {
        backgroundColor = 5082e5;
        channel = Animals;
        channelId = 17;
        created = "2014-02-12T01:16:06.000000";
        exploreIconUrl = "/static/images/channels_v2/Animals_trans@2x.png";
        exploreName = Animals;
        exploreRetinaIconUrl = "/static/images/channels_v2/Animals_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 337;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Animals.png";
        priority = 1;
        retinaIconUrl = "/static/images/channels_v2/Animals@2x.png";
    },
        {
        backgroundColor = be5fb6;
        channel = Art;
        channelId = 2;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/Art_trans@2x.png";
        exploreName = Art;
        exploreRetinaIconUrl = "/static/images/channels_v2/Art_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 2;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Art.png";
        priority = 2;
        retinaIconUrl = "/static/images/channels_v2/Art@2x.png";
    },
        {
        backgroundColor = ff5867;
        channel = Comedy;
        channelId = 1;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/Comedy_trans@2x.png";
        exploreName = Comedy;
        exploreRetinaIconUrl = "/static/images/channels_v2/Comedy_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 1;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Comedy.png";
        priority = 3;
        retinaIconUrl = "/static/images/channels_v2/Comedy@2x.png";
    },
        {
        backgroundColor = 33ccbe;
        channel = DIY;
        channelId = 1070175184667013120;
        created = "2014-04-21T23:44:20.000000";
        exploreIconUrl = "/static/images/channels_v2/DIY_trans@2x.png";
        exploreName = DIY;
        exploreRetinaIconUrl = "/static/images/channels_v2/DIY_trans@2x.png";
        exploreStyle = "<null>";
        featuredChannelId = 1070189388014780416;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/DIY.png";
        priority = 6;
        retinaIconUrl = "/static/images/channels_v2/DIY@2x.png";
    },
        {
        backgroundColor = 68bf60;
        channel = Family;
        channelId = 7;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/Family_trans@2x.png";
        exploreName = Family;
        exploreRetinaIconUrl = "/static/images/channels_v2/Family_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 7;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Family.png";
        priority = 7;
        retinaIconUrl = "/static/images/channels_v2/Family@2x.png";
    },
        {
        backgroundColor = ff794d;
        channel = Food;
        channelId = 10;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/Food_trans@2x.png";
        exploreName = Food;
        exploreRetinaIconUrl = "/static/images/channels_v2/Food_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 10;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Food.png";
        priority = 9;
        retinaIconUrl = "/static/images/channels_v2/Food@2x.png";
    },
        {
        backgroundColor = 6caff1;
        channel = "Music & Dance";
        channelId = 11;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/Music_trans@2x.png";
        exploreName = "Music & Dance";
        exploreRetinaIconUrl = "/static/images/channels_v2/Music_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 11;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Music.png";
        priority = 10;
        retinaIconUrl = "/static/images/channels_v2/Music@2x.png";
    },
        {
        backgroundColor = cccc52;
        channel = News;
        channelId = 14;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/News_trans@2x.png";
        exploreName = News;
        exploreRetinaIconUrl = "/static/images/channels_v2/News_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 14;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/News.png";
        priority = 11;
        retinaIconUrl = "/static/images/channels_v2/News@2x.png";
    },
        {
        backgroundColor = 7870cc;
        channel = Places;
        channelId = 5;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/Places_trans@2x.png";
        exploreName = Places;
        exploreRetinaIconUrl = "/static/images/channels_v2/Places_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 5;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Places.png";
        priority = 14;
        retinaIconUrl = "/static/images/channels_v2/Places@2x.png";
    },
        {
        backgroundColor = f279ac;
        channel = "Science & Tech";
        channelId = 1070175340166619136;
        created = "2014-04-21T23:44:57.000000";
        exploreIconUrl = "/static/images/channels_v2/Science_trans@2x.png";
        exploreName = "Science & Tech";
        exploreRetinaIconUrl = "/static/images/channels_v2/Science_trans@2x.png";
        exploreStyle = "<null>";
        featuredChannelId = 1070188045032366080;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Science.png";
        priority = 15;
        retinaIconUrl = "/static/images/channels_v2/Science@2x.png";
    },
        {
        backgroundColor = 548899;
        channel = Sports;
        channelId = 9;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/Sports_trans@2x.png";
        exploreName = Sports;
        exploreRetinaIconUrl = "/static/images/channels_v2/Sports_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 9;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Sports.png";
        priority = 16;
        retinaIconUrl = "/static/images/channels_v2/Sports@2x.png";
    },
        {
        backgroundColor = ffaf40;
        channel = Style;
        channelId = 12;
        created = "2013-06-28T16:46:54.000000";
        exploreIconUrl = "/static/images/channels_v2/Fashion_trans@2x.png";
        exploreName = Style;
        exploreRetinaIconUrl = "/static/images/channels_v2/Fashion_trans@2x.png";
        exploreStyle = icon;
        featuredChannelId = 12;
        fontColor = ffffff;
        iconUrl = "/static/images/channels_v2/Fashion.png";
        priority = 17;
        retinaIconUrl = "/static/images/channels_v2/Fashion@2x.png";
    }
) as an NSUserDefaults value for key kChannelList

=========================================

DONE

OK, I found what caused this error. In the object I try to save into NSUserDefault, there are some NSNull object. (you can search with keyword "NSNull" in my post)

Under iOS 7.1.1, iOS just showed a warning message but on iOS 7.1.1, APP WILL CRASH

SOLUTION

Remove all keys with NSNull values. I'm using AFNetworking, so I wrote:

+ (AFJSONResponseSerializer *)afJsonResponseserializer {
    AFJSONResponseSerializer *ret = [AFJSONResponseSerializer serializer];
    ret.removesKeysWithNullValues = YES;
    return ret;
}

And use it everywhere I need to parson JSon

Tony
  • 4,311
  • 26
  • 49

1 Answers1

0

Try to add only a part of this code at the time. You should be able to narrow it down to the line giving the error.

With this in mind, remember that property lists consist only of certain types of data: dictionaries, arrays, strings, numbers (integer and float), dates, binary data, and Boolean values. If for instance your icon is a UIImage, then it is not allowed to be added to a plist.

Jorn
  • 1,054
  • 9
  • 25