Wednesday 13 July 2016

Bug from Facebook in iOS app

When you add Facebook login/share/post..... in your iOS app. It's easy to integrate to your app if the app is simple. If the app is customized with custom navigation bar, you will get this error every time Facebook needs to popup VC then crashes.
 *** Assertion failure in -[UICGColor encodeWithCoder:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UIColor.m:1457
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only RGBA or White color spaces are supported in this situation.'
This is an error from facebook because they cannot work with customized navigation bar. To fix this. You need to find where navigationbar is colored with image, for example:
[[UINavigationBar appearancesetBarTintColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_top_pattern"]]]; 
Change to:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"bg_top_pattern"] forBarMetrics:UIBarMetricsDefault]; 

The error is gone!

No comments:

Post a Comment