アバター用のリモートイメージをロードしようとすると、自分のイメージにnilを指定できないというエラーが表示され、アプリケーションがクラッシュします。私は単にアプリが成功ログに取得する前にクラッシュさリモートイメージのロード中にJSQMessagesAvatarImageFactoryが破損しています
- (void)viewDidLoad {
[super viewDidLoad];
self.inputToolbar.contentView.textView.pasteDelegate = self;
self.userAvatarDictionary = [[NSMutableDictionary alloc] init];
self.latestGuid = @"";
/**
* Load up our fake data for the demo
*/
self.demoData = [[DemoModelData alloc] init];
/**
* You can set custom avatar sizes
*/
self.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSizeMake(30, 30);
self.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage jsq_defaultTypingIndicatorImage]
style:UIBarButtonItemStylePlain
target:self
action:@selector(receiveMessagePressed:)];
//Load remote image for Gibson Les Paul Guitar as test
NSString *imgURLString = @"http://images.gibson.com/Products/Electric-Guitars/Les-Paul/Gibson-USA/Les-Paul-Studio/Splash-02.jpg";
NSURL *url = [NSURL URLWithString:imgURLString];
NSLog(@"CREATED USER ID: 13");
NSLog(@"CREATOR IMAGE URL: %@", imgURLString);
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *dataLoadedImg = [UIImage imageWithData:data];
JSQMessagesAvatarImage *img = [JSQMessagesAvatarImageFactory avatarImageWithImage:dataLoadedImg diameter:20.0f];
[self.userAvatarDictionary setObject:img forKey:@"13"];
NSLog(@"ADDED GIBSON ICON SUCCESSFULLY");
[self callViewMessagesListWithLatestMessageGuid:self.latestGuid
CompletionBlock:^(NSMutableArray *resultsArray) {
[self reloadData:resultsArray];
}];
[NSTimer scheduledTimerWithTimeInterval:15.0 target:self selector:@selector(fifteenSecondsPassed:) userInfo:nil repeats:YES];
}
を当分の間、私のviewDidLoadメソッドでアバターの作成を追加していて、明らかにメッセージの負荷Webサービスが呼び出され取得されていません。
Logging/Error messaging:
CREATED USER ID: 13
CREATOR IMAGE URL: http://images.gibson.com/Products/Electric-Guitars/Les-Paul/Gibson-USA/Les-Paul-Studio/Splash-02.jpg
*** Assertion failure in +[JSQMessagesAvatarImageFactory jsq_circularImage:withDiameter:highlightedColor:], /Users/propstm/Documents/Github/MyProject/Pods/JSQMessagesViewController/JSQMessagesViewController/Factories/JSQMessagesAvatarImageFactory.m:132
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: image != nil'