UITextFieldView markedTextRange crash on iOS4? - ios

My apps use UITextFieldView to receive input method from user and work fine on iOS6/iOS7. and I am using the following code to prevent user input chinese/japanese/something like that. Method to detect the real input words:
-(void)textFieldChanged:(UITextField *)textField
//crash here if device iOS version at 4.3
UITextRange *selectRange = [textField markedTextRange];
if (selectRange == nil)
//get word to do something...
Crash log :
2013-11-20 12:35:09.480 [My app][203:607]-[UITextField markedTextRange]: unrecognized selector sent to instance 0x287e270
2013-11-20 12:35:09.480 [My app][203:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextField markedTextRange]: unrecognized selector sent to instance 0x287e270'

Related

NSInternalInconsistencyException - Animator is already stopped

Currently getting the following runtime exception
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Animator <UIViewPropertyAnimator(0x600003f24200) [stopped] interruptible> is already stopped!'
Because of the following line of code
// other code up here that modifies offsetAnimator
...
// stop any current running animations on offset
if let offsetAnimator = offsetAnimator {
offsetAnimator.stopAnimation(false) // this line is where the exception gets raised
offsetAnimator.finishAnimation(at: .end)
}
What is perplexing, however, is why this error is NOT readily reproducible
// doing this doesn't always result in an error
if let offsetAnimator = offsetAnimator {
offsetAnimator.stopAnimation(false)
offsetAnimator.finishAnimation(at: .end)
offsetAnimator.stopAnimation(false)
offsetAnimator.finishAnimation(at: .end)
}
What on earth is happening? Can someone explain to me why this error is occurring?
Why does it seem to only happen sporadically? Shouldn't calling .stop twice always trigger it?

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

[CIContext initWithOptions:]: unrecognized selector sent to instance 0x170400960 in xcode8

run in ios8.3 ,but run in ios9 or 10 hasn't this problem.
-[CIContext initWithOptions:]: unrecognized selector sent to instance 0x170400960
2016-09-19 18:08:21.025 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CIContext initWithOptions:]: unrecognized selector sent to instance 0x170400960'
*** First throw call stack:
(0x186d8c2d8 0x1985b00e4 0x186d933a4 0x186d90154 0x186c92ccc 0x1001c1e74 0x1001c1b7c 0x1001c143c 0x1001c1cfc 0x100311e0c 0x1003116d0 0x1001d7690 0x101f3025c 0x101f2fc08 0x101eee29c 0x103db8fd4 0x103db8f94 0x103dbdc28 0x186d437f8 0x186d418a0 0x186c6d2d4 0x1904836fc 0x18b832fac 0x100401fd8 0x198c2ea08)
libc++abi.dylib: terminating with uncaught exception of type NSException
If you look at the crash report, it seems that Xcode 8 has some issue converting the Swift method CIContext(options: [String : Any]?) to its Objective-C counterpart + (CIContext *)contextWithOptions:(NSDictionary<NSString *,id> *)options;.
Instead it is converted as -[CIContext initWithOptions:] hence the unrecognized selector.
One possible workaround is to declare an Objective-C category like this:
#interface CIContext (Workaround)
+ (CIContext *)yourprefix_contextWithOptions:(NSDictionary<NSString *, id> *)options;
#end
#implementation CIContext (Workaround)
+ (CIContext *)yourprefix_contextWithOptions:(NSDictionary<NSString *, id> *)options {
return [CIContext contextWithOptions:options];
}
#end
Then import this category in your module bridging header and replace your original CIContext init call with the one from this category.
I imagine this is a compilation issue that can be fixed with an Xcode update. In the meantime, this workaround may be helpful.

iOs: Error while cancelling performrequest

In my iOs SpriteKit application, I play voice overs using the AVAudioPlayer after a certain amount of seconds after a user action, like so:
[self.vOSoundManager performSelector:#selector(playVoiceOverWithName:) withObject:#"Voiceover_waarhondenbrokken3" afterDelay:8.0];
[self.vOSoundManager setRequestBeingPerformed:TRUE];
When a user performs another action, the sound should stop playing. I do this like so:
if(self.vOSoundManager.requestBeingPerformed){
[NSObject cancelPreviousPerformRequestsWithTarget:self.vOSoundManager];
[self.vOSoundManager stopCurrentSound];
}
The stopCurrentSound method in VoiceOverSoundManager:
- (void)stopCurrentSound{
self.playing = FALSE;
[self.voiceOverPlayer stop];
self.voiceOverPlayer = nil;
}
When the cancelPreviousPerformRequestsWithTarget method is called, I get the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[VoiceOverSoundManager name]: unrecognized selector sent to instance 0x155a9590'
I have no idea why. Does anyone have a solution?
If you are using one instance of player to play all sounds in your game, this could be a problem if you don't re-create it after stopCurrentSound method is executed:
self.voiceOverPlayer = nil;
Try to remove this line or create a new player instance.

Resources