objectForKeyedSubscript: crash on iOS 5.1

后端 未结 3 1255
借酒劲吻你
借酒劲吻你 2021-01-17 03:15

I\'m running some code that does a [NSDictionary objectForKeyedSubscript:] and it\'s crashing on iOS 5, but not iOS 6. I am using xcode 4.5.2 and compiling against the iOS

3条回答
  •  鱼传尺愫
    2021-01-17 04:21

    OK, I'm going to answer my own questions, although I don't completely understand why it was failing.

    Using objectForKeyedSubscript: and the like works fine running in iOS 5 (as long as it was compiled against the iOS 6 SDK).

    The problem was I named a function +(void)load and making objectForKeyedSubscript: calls in this function causes an assert due to the method not being found.

    This was an naming error on my part because the load method is called before the App is fully running. I have changed the name of my function and all is well.

    I assume +load is being called before something with NSDictionary is fully inited. Odd that it works under iOS 6 and just not iOS 5.

    Maybe that's not odd.

提交回复
热议问题