Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIImage systemImageNamed:]: - ios

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIImage systemImageNamed:]:
The above error is received on running the below code:
let image = UIImage(systemName: "square.and.pencil")

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?

Terminating app due to uncaught exception 'NSRangeException' when calling dequeueReusableCellWithReuseIdentifier:forIndexPath:

We've run into a crash and all we can see is these from the crashlog:
2018-11-02 10:15:01.744674-0400 Flights[385:17563] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x18555ed8c 0x1847185ec 0x1854f7750 0x1854e48ac 0x18f266b04 0x18f266084 0x18f265fd8 0x18f265eb8 0x18f2859dc 0x18f286c00 0x18f286a2c 0x100b1c304 0x100ea8b6c 0x100eaa24c 0x100eaa30c 0x100eaa680 0x185566580 0x185445748 0x18544a56c 0x10573e0c8 0x1855642d4 0x18544a41c 0x18f266f60 0x18f266084 0x18f265fd8 0x18f265eb8 0x18f265500 0x18f264730 0x18f133770 0x1896d525c 0x1896d93ec 0x189645aa0 0x18966d5d0 0x18966e450 0x185506910 0x185504238 0x185504884 0x185424da8 0x187407020 0x18f40578c 0x100b8c760 0x184eb5fc0)
libc++abi.dylib: terminating with uncaught exception of type NSException
We've enabled the all exceptions breakpoints and it points us to this line of code:
UICollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:path];
One thing that is very weird is that we can only reproduce this in iOS 11.3 devices. But all our other test devices work fine.
We are pretty much stuck. Anybody runs into this before and knows any workaround?
Not sure if it is a bug in iOS 11 or not, but the crash is cost by the following code of trying to dequeue a cell for sizing purposes in collectionView:collectionViewLayout:sizeForItemAt: and works fine on iOS 12 and above:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let cell = self.collectionView(collectionView, cellForItemAt: indexPath)
let size = cell.systemLayoutSizeFitting(...)
return CGSize(width: collectionView.frame.width, height: size.height)
}
And we are loading the nib with bundle parameter being nil as the following.
let nib = UINib(nibName: "MyCell", bundle: nil)
collectionView.register(nib, forCellWithReuseIdentifier: "MyCell")
That for some reason gives us the obscure exception:
2018-11-02 10:15:01.744674-0400 Flights[385:17563] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x18555ed8c 0x1847185ec 0x1854f7750 0x1854e48ac 0x18f266b04 0x18f266084 0x18f265fd8 0x18f265eb8 0x18f2859dc 0x18f286c00 0x18f286a2c 0x100b1c304 0x100ea8b6c 0x100eaa24c 0x100eaa30c 0x100eaa680 0x185566580 0x185445748 0x18544a56c 0x10573e0c8 0x1855642d4 0x18544a41c 0x18f266f60 0x18f266084 0x18f265fd8 0x18f265eb8 0x18f265500 0x18f264730 0x18f133770 0x1896d525c 0x1896d93ec 0x189645aa0 0x18966d5d0 0x18966e450 0x185506910 0x185504238 0x185504884 0x185424da8 0x187407020 0x18f40578c 0x100b8c760 0x184eb5fc0)
libc++abi.dylib: terminating with uncaught exception of type NSException
However, changing the bundle parameter being .main (thanks to the comments) like the following give us a more appropriate crash log and call stack.
let nib = UINib(nibName: "MyCell", bundle: .main)
That leads us to the actual solution to the problem: do not call collectionView(collectionView, cellForItemAt: indexPath) during layout.

xcode8 project crash by xcode9 reason: 'Sigh. Contentview size is zero running on ios11

2017-10-26 14:42:50.817301+0800 thememaker[32585:4041966] [MC] Loaded MobileCoreServices.framework
2017-10-26 14:42:50.822148+0800 thememaker[32585:4041966] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-10-26 14:42:51.295291+0800 thememaker[32585:4041966] * Assertion failure in -[_UINavigationBarVisualProviderModernIOS _contentViewFittingHeight], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3694.4.18/_UINavigationBarVisualProviderModernIOS.m:544
2017-10-26 14:42:51.297238+0800 thememaker[32585:4041966] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Sigh. Contentview size is zero.'
*** First throw call stack:
(0x185e93d38 0x1853a8528 0x185e93c0c 0x186822c24 0x18fdf79cc 0x18fbf3518 0x18fdf9efc 0x18f5ae8f4 0x18f632ca4 0x18f632bac 0x18f333dfc 0x18f333c44 0x18f331de0 0x18f2a38a4 0x18f2a37d4 0x100b0b5ac 0x100b08f58 0x100b08c40 0x18f82a8bc 0x18f9d3588 0x18f9d32c0 0x18f5abd8c 0x18f9d3588 0x18f9d32c0 0x18fbf1774 0x18f9d3588 0x18f9d32c0 0x18f609ae4 0x18f82a8bc 0x18f9d3588 0x18f9d32c0 0x18f82a560 0x18f82ad00 0x18f9d3588 0x18f9d3700 0x18f9d32c0 0x18f8298a0 0x18fba67f0 0x18f50c8dc 0x18f312cdc 0x18f50b5c0 0x18f799454 0x18fa691f0 0x18f7990b8 0x18f799928 0x18ff026e8 0x18ff0258c 0x18fc7e9c0 0x18fe13fc8 0x18fc7e870 0x18fa68850 0x18f509e28 0x18f90d6ec 0x188535768 0x18853e070 0x1026f945c 0x102705b74 0x188569a04 0x1885696a8 0x188569c44 0x185e3c358 0x185e3c2d8 0x185e3bb60 0x185e39738 0x185d5a2d8 0x187bebf84 0x18f307880 0x100b5dccc 0x18587e56c)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
running ios10 it's worked fine.
but running on ios11 crashed:(
when I start app crashed and not execute didFinishLaunchingWithOptions
Any help on this ? thanks.

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

UITextFieldView markedTextRange crash on iOS4?

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'

Resources