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

TSMessageView ios9 crash #257

Open
guakeliao opened this issue Oct 10, 2015 · 10 comments
Open

TSMessageView ios9 crash #257

guakeliao opened this issue Oct 10, 2015 · 10 comments

Comments

@guakeliao
Copy link

  • (NSMutableDictionary *)notificationDesign
    {
    if (!_notificationDesign)
    {
    NSString *path = [[NSBundle mainBundle] pathForResource:TSDesignFileName ofType:@"json"];
    NSData *data = [NSData dataWithContentsOfFile:path];
    NSAssert(data != nil, @"Could not read TSMessages config file from main bundle with name %@.json", TSDesignFileName);

    _notificationDesign = [NSMutableDictionary dictionaryWithDictionary:[NSJSONSerialization JSONObjectWithData:data
                                                                                                        options:kNilOptions
                                                                                                          error:nil]];
    

    }

    return _notificationDesign;
    }

@adamszeptycki
Copy link

+1

@domingguss
Copy link

Here, in better markdown:

    + (NSMutableDictionary *)notificationDesign
    {
        if (!_notificationDesign)
        {
            NSString *path = [[NSBundle mainBundle] pathForResource:TSDesignFileName ofType:@"json"];
            NSData *data = [NSData dataWithContentsOfFile:path];
            NSAssert(data != nil, @"Could not read TSMessages config file from main bundle with name %@.json", TSDesignFileName);

            _notificationDesign = [NSMutableDictionary dictionaryWithDictionary:[NSJSONSerialization JSONObjectWithData:data
                                                                                                                options:kNilOptions
                                                                                                                  error:nil]];
        }

        return _notificationDesign;
    }

This results in a direct crash on iOS9:

 <Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not read TSMessages config file from main bundle with name TSMessagesDefaultDesign.json'

iOS9 can't find the right bundle probably :s
This might also be related to how Cocoapods creates bundles, or iOS9 handling them...
Might use resource_bundle in podspec

@guy-shahine
Copy link

I was able to work around the issue by adding the TSMessagesDefaultDesign.json to the "copy bundle resources" section in project Build Phases

@mRs-
Copy link
Collaborator

mRs- commented Oct 23, 2015

I think it's something related to the new CocoaPods version

@mRs-
Copy link
Collaborator

mRs- commented Oct 23, 2015

I got the same issue and it was caused by use_frameworks! in my pod file for a obj-c, swift bridging hell.

I used first https://github.com/CocoaPods/cocoapods-deintegrate to deintegrate the complete cocoapods integration and afterwards i run pod install again.

@max-potapov
Copy link

use framework's bundle instead of app's bundle

NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:TSDesignFileName ofType:@"json"];

@zkirill
Copy link

zkirill commented Nov 9, 2015

The fix by @max-potapov works. Thank you! May we have a PR?

@brianchen003
Copy link

g *path = [[NSBundle bundleForClass:[self class]] pathForResource:TSDesignFileName ofType:@"json"]; is not helpful for me

@zkirill
Copy link

zkirill commented Nov 20, 2015

@Brian-Chen049 Change that line in TSMessageView.m in notificationDesign function.

@tonchis
Copy link

tonchis commented Mar 24, 2016

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

9 participants