NSInvalidArgumentException

0

Good morning!

I have an app that was developed for me, I have no knowledge in swift, cocoa and others. When trying to run the app I get the following error:

2018-05-28 10:22:09.264671-0500 GP[1557:49855] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSConcreteMutableAttributedString initWithString:: nil value'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010497e1e6 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x0000000103bcc031 objc_exception_throw + 48
    2   CoreFoundation                      0x00000001049f3975 +[NSException raise:format:] + 197
    3   Foundation                          0x00000001035e9a68 -[NSConcreteMutableAttributedString initWithString:] + 129
    4   GP                                  0x000000010329b22f +[JsonReader createFromJson:] + 159
    5   GP                                  0x0000000103291554 -[UIMapViewController collectionView:cellForItemAtIndexPath:] + 484
    6   UIKit                               0x00000001059fe626 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 295
    7   UIKit                               0x00000001059fe4f9 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 35
    8   UIKit                               0x0000000105a0377e -[UICollectionView _updateVisibleCellsNow:] + 4505
    9   UIKit                               0x0000000105a09558 -[UICollectionView layoutSubviews] + 364
    10  UIKit                               0x000000010500a808 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515
    11  QuartzCore                          0x000000010ad0d61a -[CALayer layoutSublayers] + 177
    12  QuartzCore                          0x000000010ad1182b _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
    13  QuartzCore                          0x000000010ac9829f _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
    14  QuartzCore                          0x000000010acc5940 _ZN2CA11Transaction6commitEv + 568
    15  UIKit                               0x0000000104f3534f _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
    16  UIKit                               0x000000010589a532 __handleEventQueueInternal + 6875
    17  CoreFoundation                      0x0000000104920bb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    18  CoreFoundation                      0x00000001049054af __CFRunLoopDoSources0 + 271
    19  CoreFoundation                      0x0000000104904a6f __CFRunLoopRun + 1263
    20  CoreFoundation                      0x000000010490430b CFRunLoopRunSpecific + 635
    21  GraphicsServices                    0x000000010b5f9a73 GSEventRunModal + 62
    22  UIKit                               0x0000000104f3b0b7 UIApplicationMain + 159
    23  GP                                  0x000000010329af0f main + 111
    24  libdyld.dylib                       0x0000000108517955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Could someone guide me to solve this situation thanks

    
asked by cignius 28.05.2018 в 17:47
source

2 answers

0

First of all I would recommend a brief review of Swift if you are going to work with him. Secondly, it would be good to debug you to know exactly where this error is coming from and, failing that, to publish the code in order to provide the community with more information to be able to answer you.

In your case, you are assigning (I do not know where because I do not see the code) to something a value that is null. (Look at the reason).

    
answered by 28.05.2018 в 18:16
0

From what I read in the error NSConcreteMutableString I try to start with a null string, ( nil ). This could be because the string was not initialized or assigned the value nil .

In order to debug this error, I would put a Breakpoint for All Exceptions . This breakpoint will stop the program when an exception like the one that happened to you is generated.

To add this, perform the following steps:

  • Go to the Breakpoint Navigator tab
  • Click on the + symbol, in the lower left corner.
  • Select Exception Breakpoint
  • I attached an image with the steps mentioned above.

        
    answered by 31.05.2018 в 17:25