qgL7c.png https://i.stack.imgur.com/eQFtK.jpg

After updating latest FCM SDK I am getting my app crash. trace = Performance.startTrace(name: url.absoluteString)

error log Crash assertion failure in -[firtrace inittracewithname:], firtrace.m:86. NSInternalInconsistencyException', reason: 'Name cannot be nil FCMSDK update

1

There are 1 best solutions below

0
On

Be careful if the string passed to Performance.startTrace(name:) is longer than 100 characters. Internally they are performing some sanitization with the string in a static method called NSString *FPRReservableName(NSString *name) which is not an honest API as you can see:

NSString *FPRReservableName(NSString *name) {
  NSString *reservableName =
      [name stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
  if ([reservableName hasPrefix:kFPRInternalNamePrefix]) {
    FPRLogError(kFPRClientNameReserved, @"%@ prefix is reserved. Dropped %@.",
                kFPRInternalNamePrefix, reservableName);
    return nil;
  }

  if (reservableName.length == 0) {
    FPRLogError(kFPRClientNameLengthCheckFailed, @"Given name is empty.");
    return nil;
  }

  if (reservableName.length > kFPRMaxNameLength) {
    FPRLogError(kFPRClientNameLengthCheckFailed, @"%@ is greater than %d characters, dropping it.",
                reservableName, kFPRMaxNameLength);
    return nil;
  }

  return reservableName;
}

Of course this is totally unnacceptable because it leads to unexpected crashes at runtime.