Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26369

iOS: unhandledException Ti.App event no longer working.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 7.3.0
    • Fix Version/s: Release 7.5.0
    • Component/s: iOS
    • Labels:
      None

      Description

      When stack traces where added to the display of unhandled exceptions in May 2018, the functionality was removed. I can provide a PR to fix that.
      Files that need to be modified:
      AppModule.m , line 368

      [nc addObserver:self selector:@selector(errored:) name:kTiErrorNotification object:nil];
      

      TiExceptionHandler.m , line 58

      - (void)showScriptError:(TiScriptError *)error
      {
        NSArray<NSString *> *exceptionStackTrace = [NSThread callStackSymbols];
       
        if (exceptionStackTrace == nil) {
          [[TiApp app] showModalError:[error description]];
          [[NSNotificationCenter defaultCenter] postNotificationName:kTiErrorNotification
                                                              object:self
                                                            userInfo:error.dictionaryValue];
        } else {
          NSMutableArray<NSString *> *formattedStackTrace = [[[NSMutableArray alloc] init] autorelease];
          NSUInteger exceptionStackTraceLength = [exceptionStackTrace count];
       
          // re-size stack trace and format results. Starting at index = 4 to not include the script-error API's
          for (NSInteger i = 4; i < (exceptionStackTraceLength >= 20 ? 20 : exceptionStackTraceLength); i++) {
            NSString *line = [[exceptionStackTrace objectAtIndex:i] stringByReplacingOccurrencesOfString:@"     " withString:@""];
            [formattedStackTrace addObject:line];
          }
       
          NSString *stackTrace = [formattedStackTrace componentsJoinedByString:@"\n"];
          [[TiApp app] showModalError:[NSString stringWithFormat:@"%@\n\n%@", [error description], stackTrace]];
          NSMutableDictionary *errorDict = [error.dictionaryValue mutableCopy];
          [errorDict setObject:stackTrace forKey:@"stackTrace"];
          [[NSNotificationCenter defaultCenter] postNotificationName:kTiErrorNotification
                                                              object:self
                                                            userInfo:errorDict];
        }
      }
      

        Attachments

          Activity

            People

            • Assignee:
              hknoechel Hans Knöchel
              Reporter:
              rlustemberg Richard Lustemberg
              Tester:
              Samir Mohammed
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-6568
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code