Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_NSKeyedUnarchiverHelper dealloc crash #518

Open
wongzigii opened this issue Jun 17, 2020 · 1 comment
Open

_NSKeyedUnarchiverHelper dealloc crash #518

wongzigii opened this issue Jun 17, 2020 · 1 comment

Comments

@wongzigii
Copy link

wongzigii commented Jun 17, 2020

Hello there, do you have any ideas for this unusual crash, which is located at this line? BTW, I am using YapDatabase 3.1.

I am trying to read data from database like this:

-(NSArray *)getStationsWithType:(TSLStationType)type
{
    NSMutableArray* datas = [NSMutableArray array];
    
    [[self.database newConnection] readWithBlock:^(YapDatabaseReadTransaction * _Nonnull transaction) {
        
        NSString *collection = [self typeStringWithType:type];
        [transaction enumerateKeysAndObjectsInCollection:collection usingBlock:^(NSString * _Nonnull key, id  _Nonnull object, BOOL * _Nonnull stop) {
            
            if ([object isKindOfClass:[TSLStationModel class]]) {
                TSLStationModel *m = object;
                [datas addObject:object];
            }
            
        }];
    }];
    
    return datas;
}
??? 0x000000016d782648 0x00000001ee577870
1 CoreFoundation 0x00000001b0b21c98 -[__NSArrayM dealloc]
2 Foundation 0x00000001b0f0cc84 -[_NSKeyedUnarchiverHelper dealloc]
3 Foundation 0x00000001b0f0cbf0 -[NSKeyedUnarchiver dealloc]
4 Foundation 0x00000001b0f5fbc0 +[NSKeyedUnarchiver unarchiveObjectWithData:]
5 YapDatabase 0x00000001054cc208 YapCollectionKeyHash
6 YapDatabase 0x000000010556f010 NSStringFromYapDatabaseSecondaryIndexType
7 YapDatabase 0x000000010556a8b8 NSStringFromYapDatabaseSecondaryIndexType
8 YapDatabase 0x000000010556a764 NSStringFromYapDatabaseSecondaryIndexType
9 MYAPP 0x0000000102a85f7c __42-[TSLStationsStorage getStationsWithType:]_block_invoke (TSLStationsStorage.m:0)
10 YapDatabase 0x0000000105512bb8 YapCollectionKeyHash
11 libdispatch.dylib 0x00000001b0917184 __dispatch_client_callout
12 libdispatch.dylib 0x00000001b08fb198 __dispatch_sync_invoke_and_complete_recurse
13 libdispatch.dylib 0x00000001b08fac90 __dispatch_sync_f_slow
14 YapDatabase 0x0000000105512b30 YapCollectionKeyHash
15 MYAPP 0x0000000102a85e8c -[TSLStationsStorage getStationsWithType:] (TSLStationsStorage.m:232)
16 MYAPP 0x0000000102a4a058 __45-[TSLMapManager getPointsWithType:completed:]_block_invoke (TSLMapManager.m:0)
17 libdispatch.dylib 0x00000001b0916610 __dispatch_call_block_and_release
18 libdispatch.dylib 0x00000001b0917184 __dispatch_client_callout
19 libdispatch.dylib 0x00000001b08fa34c __dispatch_main_queue_callback_4CF$VARIANT$armv81
20 CoreFoundation 0x00000001b0bc85e4 _CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
21 CoreFoundation 0x00000001b0bc35d8 ___CFRunLoopRun
22 CoreFoundation 0x00000001b0bc2adc CFRunLoopRunSpecific
23 GraphicsServices 0x00000001bab63328 GSEventRunModal
24 UIKitCore 0x00000001b4cd063c UIApplicationMain
25 MYAPP 0x00000001029f4770 main (main.m:13)
26 libdyld.dylib 0x00000001b0a4c360 _start

Edit: I've uploaded the xccrashpoint here.

@wongzigii
Copy link
Author

wongzigii commented Jun 18, 2020

https://stackoverflow.com/questions/7557800/nskeyedunarchiver-how-to-prevent-a-crash

I think unarchiveObjectWithData should be wrapped by a try-catch control flow, and unarchiveObjectWithData is deprecated in iOS 12, we need to switch to latest API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant