Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Crash while opening a PDF with Forms #61

Open
ComputopDeveloper opened this issue Aug 4, 2017 · 0 comments
Open

Crash while opening a PDF with Forms #61

ComputopDeveloper opened this issue Aug 4, 2017 · 0 comments

Comments

@ComputopDeveloper
Copy link

For the most cases I'm able to open PDF with forms, but for a special file the app is crashing because of

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKeyedSubscript:]: unrecognized selector sent to instance

If find out that the ILPDFFormContainer is the reason for that. Especially in the populateNameTreeNode: method you expect a NSMutableDictionary, but in my case here it is an array:

   ...
    NSMutableDictionary *dict  = node[base];  // here in the dict var there comes an array and not dictionary, the base is "1" as STRING
    if (dict == nil) {
        dict = [NSMutableDictionary dictionary];
        node[base] = dict;
    }
    [self populateNameTreeNode:dict withComponents:[components subarrayWithRange:NSMakeRange(1, [components count]-1)] final:final];

My bad solution was it to check for the class, and in case that it is not a dictionary I don't populate:

    NSMutableDictionary *dict  = node[base];
    if (dict == nil) {
        dict = [NSMutableDictionary dictionary];
        node[base] = dict;
    }
    if ([dict isKindOfClass:[NSMutableDictionary class]])
    {
        [self populateNameTreeNode:dict withComponents:[components subarrayWithRange:NSMakeRange(1, [components count]-1)] final:final];
    }

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

No branches or pull requests

1 participant