HomeiOS Developmentgoogle cloud firestore - Firebase crash log in iOS: objcThrowHandler(sort, file, func,...

google cloud firestore – Firebase crash log in iOS: objcThrowHandler(sort, file, func, line, message)


I submit my iOS app in Apple Retailer Join.

And it’s rejected with crash log file.

After I run this app with my actual telephone, it really works effective even the half that they mentioned it crashes, it really works properly.

So I open crash log and it appears fireStore causes error.

2 information they despatched me was under.

1)

#embrace "Firestore/core/src/util/exception_apple.h"

#import <Basis/Basis.h>

#embrace <exception>

#embrace "Firestore/core/src/util/hard_assert.h"
#embrace "Firestore/core/src/util/string_apple.h"

NS_ASSUME_NONNULL_BEGIN

namespace firebase {
namespace firestore {
namespace util {
namespace {

NSString* ExceptionName(ExceptionType exception) {
  swap (exception) {
    case ExceptionType::AssertionFailure:
      return @"FIRESTORE INTERNAL ASSERTION FAILED";
    case ExceptionType::IllegalState:
      return @"FIRIllegalStateException";
    case ExceptionType::InvalidArgument:
      return @"FIRInvalidArgumentException";
  }
  UNREACHABLE();
}

NSException* MakeException(ExceptionType sort, const std::string& message) {
  return [[NSException alloc] initWithName:ExceptionName(sort)
                                    motive:MakeNSString(message)
                                  userInfo:nil];
}

}  // namespace

ABSL_ATTRIBUTE_NORETURN void ObjcThrowHandler(ExceptionType sort,
                                              const char* file,
                                              const char* func,
                                              int line,
                                              const std::string& message) {
  if (sort == ExceptionType::AssertionFailure) {
    [[NSAssertionHandler currentHandler]
        handleFailureInFunction:MakeNSString(func)
                           file:MakeNSString(file)
                     lineNumber:line
                    description:@"%@: %@", ExceptionName(sort),
                                MakeNSString(message)];
    std::terminate();
  } else {
    @throw MakeException(sort, message);  // NOLINT
  }
}

}  // namespace util
}  // namespace firestore
}  // namespace firebase

NS_ASSUME_NONNULL_END

2)

#embrace "Firestore/core/src/util/exception.h"

#embrace <exception>
#embrace <stdexcept>

#embrace "Firestore/core/src/util/firestore_exceptions.h"
#embrace "Firestore/core/src/util/hard_assert.h"
#embrace "Firestore/core/src/util/log.h"
#embrace "absl/strings/str_cat.h"

namespace firebase {
namespace firestore {
namespace util {
namespace {

const char* ExceptionName(ExceptionType exception) {
  swap (exception) {
    case ExceptionType::AssertionFailure:
      return "FIRESTORE INTERNAL ASSERTION FAILED";
    case ExceptionType::IllegalState:
      return "Unlawful state";
    case ExceptionType::InvalidArgument:
      return "Invalid argument";
  }
  UNREACHABLE();
}

ABSL_ATTRIBUTE_NORETURN void DefaultThrowHandler(ExceptionType sort,
                                                 const char* file,
                                                 const char* func,
                                                 int line,
                                                 const std::string& message) {
  std::string what = absl::StrCat(ExceptionName(sort), ": ");
  if (file && func) {
    absl::StrAppend(&what, file, "(", line, ") ", func, ": ");
  }
  absl::StrAppend(&what, message);

  // All the time log the error -- it helps if there are any points with the exception
  // propagation mechanism and in addition makes positive the exception makes it into the
  // log no matter the way it's dealt with.
  LOG_ERROR("%s", what);

#if ABSL_HAVE_EXCEPTIONS
  swap (sort) {
    case ExceptionType::AssertionFailure:
      throw FirestoreInternalError(what);
    case ExceptionType::IllegalState:
      // Omit descriptive textual content because the sort already encodes the sort of error.
      throw std::logic_error(message);
    case ExceptionType::InvalidArgument:
      // Omit descriptive textual content because the sort already encodes the sort of error.
      throw std::invalid_argument(message);
  }
#else
  std::terminate();
#endif

  UNREACHABLE();
}

ThrowHandler throw_handler = DefaultThrowHandler;

}  // namespace

ThrowHandler SetThrowHandler(ThrowHandler handler) {
  ThrowHandler earlier = throw_handler;
  throw_handler = handler;
  return earlier;
}

ABSL_ATTRIBUTE_NORETURN void Throw(ExceptionType exception,
                                   const char* file,
                                   const char* func,
                                   int line,
                                   const std::string& message) {
  throw_handler(exception, file, func, line, message);

  // It is anticipated that the throw handler above doesn't return. If it does,
  // simply terminate.
  std::terminate();
}

}  // namespace util
}  // namespace firestore
}  // namespace firebase

From the half that they mentioned to trigger error in my app solely use fireBase one line.

    ref.learn(userProvider).when(
                                                      information: (information) {
                                                        return Container(
                                                          width: 35,
                                                          peak: 35,
                                                          ornament:
                                                              const BoxDecoration(
                                                            form:
                                                                BoxShape.circle,
                                                          ),
                                                          clipBehavior:
                                                              Clip.hardEdge,
                                                          youngster: Picture.community(
                                                            information.avatar,
                                                            match: BoxFit.cowl,
                                                          ),
                                                        );
                                                      },
                                                      loading: () =>
                                                          Container(),
                                                      error:
                                                          (error, stackTrace) =>
                                                              Container(),
                                                    )

And userProvider riverpod lookes like under:

class UserProvider extends AsyncNotifier<UserProfile> {
  late last AuthenticationRepository _authRepo;

  @override
  FutureOr<UserProfile> construct() async {
    state = const AsyncValue.loading();
    _authRepo = ref.learn(authRepo);
    UserProfile userProfile = await fetchLoggedUserInfo();
    state = AsyncValue.information(userProfile);
    return userProfile;
  }

  Future<UserProfile> fetchLoggedUserInfo() async {
    state = const AsyncValue.loading();
    Map<String, dynamic>? userData = await _authRepo.fetchLoggedUserInfoDB();
    UserProfile userProfile = UserProfile.fromJson(userData!);
    state = AsyncValue.information(userProfile);
    return userProfile;
  }
}

last userProvider = AsyncNotifierProvider<UserProvider, UserProfile>(
  () => UserProvider(),
);

Since I deal with error with when methodology, I do not know why app crashes with fireStore on this half.

And concerning studying crash log, there is not any a lot reference on web furthermore it really works effective on my telephone I am unable to verify debug or do one thing extra..

Are you able to assist me how can I proceed with this error?

If any recommendation can be useful..

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments