iphone - Error Handling - NSKeyedUnarchiver -
i using nskeyedarchiver / nskeyedunarchiver send objects on bluetooth ipad iphone remote control. works, shown here.
however, if remote control receives data isn't archived (for example, random nsstring), entire application crashes. want able "if data in archive object x, unarchive , following, ignore otherwise".
is there way handle errors nskeyedunarchiver?
here's code:
- (nsmutabledictionary *)unpackreceivednsmutabledictionaryfromdata:(nsdata *)receiveddata { nskeyedunarchiver *unarchiver = [[nskeyedunarchiver alloc] initforreadingwithdata:receiveddata]; nsmutabledictionary *receiveddictionary = [[unarchiver decodeobjectforkey:@"mykey"] retain]; [unarchiver finishdecoding]; [unarchiver release]; return receiveddictionary; }
any suggestions welcome! first time posting on stackoverflow...
okay, figured out after lot of debugging... releasing data earlier caused exc_bad_access. used nszombies track coming , removed data release.
Comments
Post a Comment