iOS crash 'failed to generate newParagraphStyle' - ios

After I add a library (a internal common library) to my project I received the following crash:
*** Assertion failure in -[_UICascadingTextStorage setTextAlignment:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/TextSystem/_UICascadingTextStorage.m:270
Project[784:18448] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to generate newParagraphStyle'
I can't find what are the reasons for the type of crash or what I did wrong for this.
Note: I added the Libray but I haven't yet used any features from library.
Can anyone help me?

The library may call +initialize or +load or do some general swizzling/overriding of Apple classes and it can mess something up, e.g. in a new iOS version, if APIs changed.
If you have the src for the library, look for those things.
Also create an exception breakpoint, maybe it will point you to the problem in code.

Related

Xcode error on running app with embedded framework

I am trying to create framework of my existing app which can be added to any other app as a module. In previous version of the app, i don't have any issues creating the framework and adding it to a demo app to test if it works. With newer version of the app, i am having an issue:
2017-04-21 13:59:02.238333-0400 XXX[8320:3762763] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x1868c2fd8 0x185324538 0x1867a4888 0x1010c3948 0x18c9f1f9c 0x18ca09a28 0x18cb8e2a0 0x18caa8c4c 0x18caa88b4 0x18caa8818 0x18c9ef158 0x189bdf274 0x189bd3de8 0x189bd3ca8 0x189b4f360 0x189b763c0 0x189b76e8c 0x1868709a0 0x18686e628 0x18686ea74 0x18679ed94 0x188208074 0x18ca57130 0x100084860 0x1857ad59c)
libc++abi.dylib: terminating with uncaught exception of type NSException
Any suggestions how to trace back the error inside the embedded framework?
It is happening only with the main View Controllers of the app, not on any off the second level View Controllers which are accessed from these main View Controllers.
I went through the code of the old version and the new version of the embedded framework, i don't see anything major to be different, checked Line by Line the whole code.
Any suggestions?
Thank you codealchimist for the solution, i figure out what i was missing in order to be able to debug it. The solution provided by him solves the problem to be able to debug the app & framework.

iOS Wikitude SDK crash on exit/reopen app

I've developed a simply app for iOS and Augmented Reality (with WikitudeSDK).
All go fine, but when I exit and reopen the app, at times the app crashes with the following message:
Assertion failure in -[WTGCDDriver createSharedContextWithId:], /Users/emperor/Development/Tools/Jenkins/Master/Instance/jobs/architect_sdk_builder/workspace/repositories/ios_core_services/src/Rendering/Driver/WTDriver.mm:71
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: _context'
Have you any idea of this?
Thanks.
For some reason the OpenGL context is null when you reopen your app; you receive this error because we seem to have forgotten to disable assertions for a public build. So thanks for making us aware of this oversight.
With respect to the actual issue, I cannot provide an answer without having more of an insight into what exactly your app is doing and which version and configuration of the SDK you are using.
I'd therefore like you to create a thread in the Wikitude forums which provides a platform that is better suited for assisting you with this issue than Stack Overflow is.

How to identify crash from XIB

I don't have any code implemented in view controller to set the font or attributedLabel. But I'm seeing crash with below reason.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: -[_SwiftValue pointSize]: unrecognized selector sent to instance 0x610001040ba0
There is another way of debugging issue. When app is crashed, check left panel and you will observe threads stack. In that find out Obj_exception_throw select that and use your logging area to run command po $arg1. This may give you the correct reason for crashing.
Or else, you can try using Application Unit tests for verifying all your IBOutlets and objects, loaded from NIBs.
You can select that xib and open it as source code.
Or search tho whole project to find that.

Using React Native within an iOS share extension

Jumping off of this facebook/react-native#1626 GitHub issue, I had a question about setting up a React Native view within an iOS share extension
I posted an example GitHub repo that demonstrates the problem, summarized below.
So far the proof-of-concept setup is pretty straightforward, but I feel like I'm missing something very simple.
In my react-native init scaffolded Xcode project I created a new Share Extension target, and within it linked the appropriate React Native static libraries (libReact.a, libRCTWebSocket.a, etc.). This gets our project compiling for a very simple ShareViewController that's a plain ‘ol UIViewController.
Upon activating my Share Extension from another app, my ShareViewController is initialized but immediately crashes with the following log messages:
2015-11-29 12:44:34.721 [warn][tid:com.facebook.React.JavaScript][RCTContextExecutor.m:129] 'undefined is not an object (evaluating \'RCTWebSocketModule.connect\')'
2015-11-29 12:44:34.726 ShareExtension[66473:2179009] -[RCTBatchedBridge redBox]: unrecognized selector sent to instance 0x7fb59d8ab200
2015-11-29 12:53:47.160 [warn][tid:com.facebook.React.JavaScript][RCTContextExecutor.m:129] 'Requiring module "InitializeJavaScriptAppEngine" which threw an exception'
2015-11-29 12:53:47.160 ShareExtension[66473:2179009] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RCTBatchedBridge redBox]: unrecognized selector sent to instance 0x7fb59d8ab200'
The line 'Requiring module "InitializeJavaScriptAppEngine" which threw an exception' looks particularly suspicious, and leads me to believe that I'm missing some basic JavaScriptCore setup within the share extension. Curious to know if there are any obvious areas to investigate, or if anyone else has solved this problem. Thanks!
I had the same error and fixed it by adding "-ObjC" in my app extension target build settings (Other linker flags)

Does anyone know why this exception is being thrown in ios/cordova?

I'm working on a hybrid app with a custom InAppBrowser plugin and seemingly randomly an exception gets thrown.
I don't have any way to consistently reproduce this bug. I open that app and browser around and eventually when clicking my browser plugin's close button this will happen.
It happens within cordova after I call this line here
Where the exception actually happens
CordovaLib.xcodeproj/Classes/Commands/CDVCommandDelegateImpl.m
I have spent hours trying to find what is happening and I can't find any information online that helps. I've tried wrapping it in a try/catch to at least see if I can bypass it and that doesn't work either
The actual logged error is:
*** Assertion failure in -[DDWebKitOperation dealloc], /SourceCache/MobileDataDetectorsUI/MobileDataDetectorsUI-109.1/URLification/DDOperation.m:202
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Container should already be nil'
Does anyone know what could be causing this and how to fix it?
Thanks.
I've seen this crash in UIView's that use data detectors. In my case it was in a unit test, so the fix was to delete the data detector in the test.

Resources