Mapbox NSInternalInconsistencyException showing RMMapView on iPad - ios

Having a spot of trouble trying to get the native iOS Mapbox view working on an actual device (3rd gen iPad, iOS 7.1).
dprintf( "RMMapboxSource\n" );
RMMapboxSource * tileSource = [[RMMapboxSource alloc] initWithMapID:mystyle];
dprintf( "RMMapView\n" );
RMMapView * mapView = [[RMMapView alloc] initWithFrame:CGRectMake(0,0,900,450) andTilesource:tileSource];
dprintf( "addChild\n" );
// ... mapView then added to view hierarchy
dprintf( "setPage\n" );
// ... then make visible
Everything works great in the simulator. But trying to run on an actual iPad results in the following.
RMMapboxSource
RMMapView
addChild
setPage
2014-04-01 15:41:21.879 Protraak[1179:60b] *** Assertion failure in -[UIView layoutSubviews], /SourceCache/UIKit/UIKit-2935.137/UIView.m:5326
2014-04-01 15:41:21.881 Protraak[1179:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'layout should have been successfully accomplished'
A Google search for "layout should have been successfully accomplished" came up blank.

Can you try the latest develop branch and see if that works for you?

Related

App crash when MFMessageComposeViewController is initialisation

I want to send a message through my app. I call the following method on click
#IBAction func sendMessage(_ sender: Any) {
if (MFMessageComposeViewController.canSendText()) {
let composeVC = MFMessageComposeViewController()
composeVC.messageComposeDelegate = self
// Configure the fields of the interface.
composeVC.recipients = ["4085551212"]
composeVC.body = "Hello from California!"
// Present the view controller modally.
self.presentViewController(composeVC, animated: true, completion: nil)
}
}
The problem is if I run the app on device, it crashes at MFMessageComposeViewController initialisation i.e.
let composeVC = MFMessageComposeViewController()
If I run the app in simulator, it crashes on presentation i.e.
self.present(composeVC, animated: true, completion: nil)
Error log when I run the app on device
2018-01-29 12:03:57.826816+0530 EWS[2495:806400] *** Assertion failure in -[UICGColor encodeWithCoder:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.33.7/UIColor.m:1722
2018-01-29 12:03:57.827522+0530 EWS[2495:806400] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only RGBA or White color spaces are supported in this situation.'
*** First throw call stack:
(0x183702364 0x182948528 0x183702238 0x18409d7f4 0x18d08fffc 0x1840574dc 0x18405e8d8 0x18d4ebf20 0x18d4eb74c 0x18d4e7044 0x1835d03c0 0x18d4e6d44 0x18d7f16fc 0x18d60bd18 0x18d60b94c 0x19aee4534 0x19aecbff4 0x19aecc314 0x1984ce830 0x101159ec0 0x101158888 0x1011584b4 0x1011589c0 0x18cc186b4 0x18cc18634 0x18cc031dc 0x18cc17f28 0x18cc17a48 0x18cc12f60 0x18cbe3f64 0x18d53931c 0x18d53b8a8 0x18d5347c0 0x1836aa97c 0x1836aa8fc 0x1836aa184 0x1836a7d5c 0x1835c7e58 0x185474f84 0x18cc4767c 0x101157170 0x1830e456c)
libc++abi.dylib: terminating with uncaught exception of type NSException
Error log when I run the app on simulator (without checking if(MFMessageComposeViewController.canSendText()))
2018-01-29 12:07:49.395714+0530 EWS[3533:67163] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target <EWS.BlockVC: 0x7f899c61db10>.'
*** First throw call stack:
Any help would be appreciated.
Okay,
When you run it in iPhone : The crash log clearly states that "Only RGBA or White color spaces are supported in this situation." So by hint I would say you are assigning color somewhere, (Some Global tint, navigation bar tint) , which doesn't apply to a MFMessageComposeViewController, hence its crashing.
When you run it in the simulator :
if (MFMessageComposeViewController.canSendText()), this line will prevent it from initialising the MFMessageComposeViewController, in the simulator as it cant send text, hence when you try to present it, its not yet initialised and crashing.
On a second thought, as per your code : self.presentViewController(composeVC, animated: true, completion: nil), this line should not even be called while running in the simulator as this line is inside the if statement, which wont get through.
Also change the tint color or any while initialising the controller, and tell me what the results are.

Customize camera overlay in applozic

I am using applozic chat sdk for ios and sending images , video successfully . My requirement is to change camera overlay. When I try to add overlay on camera it crashes.
let camaraObj : ALImagePickerController = ALImagePickerController()
let overlay =UIView(frame: UIScreen.mainScreen().bounds)
overlay.backgroundColor = UIColor.redColor()
camaraObj.cameraOverlayView = overlay
Crash log: libc++abi.dylib: terminating with uncaught exception of type NSException.
Any help ?
Looks like you are not setting the sourceType. ALImagePickerController is used for sending pictures from photos only. You need to explicitly set source type if you want to use it for camera.
i.e. self.mImagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
We just tried the same and got below exception:
2017-01-30 14:30:30.954540 applozicdemo[3106:1925853] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type must be UIImagePickerControllerSourceTypeCamera' First throw call stack:
(0x1819de1c0 0x18041855c 0x187a945cc 0x187d23294 0x1003f9dcc 0x10016525c 0x10016521c 0x10016a284 0x18198bf2c 0x181989b18 0x1818b8048 0x18333e198 0x1878a42fc 0x18789f034 0x1000517b8 0x18089c5b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

iOS App keeps crashing when using an AdMob banner

I'm making an iOS 8.0+ game using Xcode 7.3.1, SpriteKit, and Swift. My app keeps on crashing whenever I add the AdMob banner to it.
I've pretty much copied the banner code from here: https://firebase.google.com/docs/admob/ios/quick-start
Here's a part of my code:
class GameViewController: UIViewController, GADBannerViewDelegate{
#IBOutlet var bannerView: GADBannerView!
override func viewDidLoad() {
super.viewDidLoad()
if let scene = GameScene(fileNamed:"GameScene") {
let skView = self.view as! SKView
skView.ignoresSiblingOrder = true
scene.scaleMode = .AspectFill
skView.presentScene(scene)
let request = GADRequest()
bannerView.delegate = self
bannerView.adUnitID = "(myAppID)"
bannerView.rootViewController = self
bannerView.loadRequest(request)
}
}
}
It runs perfectly fine on any simulator, but it crashes the app on an actual device. I keep getting this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'*** setObjectForKey: object cannot be nil (key: <f0cdd52e 01000000>)'
*** First throw call stack: (0x1820b659c 0x19280c0e4 0x181fa11f8 0x1000ed1f8 0x100bbce30 0x100bbcdf0 0x100bc7854 0x100bc0120 0x100bc975c 0x100bcaf18 0x19302d2e4 0x19302cfa8)
libc++abi.dylib: terminating with uncaught exception of type NSException(lldb)
If I remove part of the code that deals with the banner ad, my app runs perfectly.
Any suggestions on what I can do to fix it? Also, this is my first time coding an app using Xcode.
Thanks!
It took a while, but I figured it out. I found out that the Google Mobile Ads SDK framework was the problem. Version 7.9.1 doesn't seem to work on iOS 8.0, but works well on iOS 9. I'm guessing that's why it didn't run well on my device, since I was running iOS 8 with SDK 7.9.1. With earlier versions such as 7.8.0, ads can run easily on iOS 8 devices.

Assertion failure from Cocos2d CCNode.m on iOS device. Fine in simulator. Why?

Can anyone shed any light on the reason for the following failure:
*** Assertion failure in -[Alien rotation],
/Users/admininstrator/Documents/moonweed/Star Pilot v4.0/Star Pilot
#1/Libraries/cocos2d/CCNode.m:258
2014-11-06 23:28:51.680 Star Pilot #1[2141:987748] *** Terminating app due to uncaught
exception 'NSInternalInconsistencyException', reason: 'CCNode#rotation. rotationalSkewX
!= rotationalSkewY. Don't know which one to return'
Looking at the Cocos2d source, I can see that the Assertion is coming from CCNode.m, from the method below:
-(float) rotation
{
CCPhysicsBody *body = GetBodyIfRunning(self);
if(body){
return -CC_RADIANS_TO_DEGREES(body.absoluteRadians) +
NodeToPhysicsRotation(self.parent);
} else {
NSAssert( _rotationalSkewX == _rotationalSkewY, #"CCNode#rotation. rotationalSkewX != rotationalSkewY. Don't know which one to return");
return _rotationalSkewX;
}
}
The code runs fine on all simulators, using Xcode 6.1. But on my iPhone 5, it crashes. I'm struggling to figure why? I'm currently using Cocos2d V3.x.

Unusual NSInternalInconsistencyException related to device orientation

I am getting an unusual error on an iPad app I am working on:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Card''
*** First throw call stack:
(0x35ef988f 0x31872259 0x37aee7e5 0x8aadd 0x30a35e33 0x30a42391 0x30a42201 0x30a420e7 0x30a41969 0x30a416ab 0x30a4156b 0x30a000bd 0x35e581fb 0x37349aa5 0x373496bd 0x373495c9 0x30b7ea73 0x30ae0b1f 0x30b7212b 0x30b720bb 0x30a40ba9 0x30bb8927 0x34c6e2e9 0x34c6de23 0x30bbeae9 0x34c47f09 0x35e587d3 0x35e59461 0x30c741af 0x30c7594d 0x30bab509 0x30a34893 0x30a2e8d7 0x309fcc6b 0x309fc70f 0x309fc0e3 0x35bcf22b 0x35ecd523 0x35ecd4c5 0x35ecc313 0x35e4f4a5 0x35e4f36d 0x30a2da13 0x30a2ae7d 0x83631 0x835f0)
This occurs only when I change my view controllers shouldAutorotateToInterfaceOrientation from:
return YES;
to:
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
return YES;
return NO;
Why would this cause an NSInternalInconsistencyException?
I did notice when debugging, that shouldAutorotateToInterfaceOrientation gets called about 20 times by the same function: [UIViewController _isSupportedInterfaceOrientation:]. This is not done recursively.
My app only has Landscape (left) and Landscape (right) in the supported orientations and Landscape (left) as the intial orientation
Thanks in advance.

Resources