facebook / facebook/facebook-ios-sdk

App is crashing with issue [FBSDKBasicUtility _convertObjectToJSONObject:invalidObjectHandler:stop:]

Open
#2,289 0 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
Swift
Stars
8.1k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

### Checklist before submitting a bug report

- [X] I've updated to the latest released version of the SDK
- [X] I've searched for existing [GitHub issues](https://github.com/facebook/facebook-ios-sdk/issues)
- [X] I've looked for existing answers on [Stack Overflow](https://facebook.stackoverflow.com), the [Facebook Developer Community Forum](https://developers.facebook.com/community/) and the [Facebook Developers Group](https://www.facebook.com/groups/fbdevelopers)
- [X] I've read the [Code of Conduct](https://github.com/facebook/facebook-ios-sdk/blob/main/CODE_OF_CONDUCT.md)
- [X] This issue is not security related and can safely be disclosed publicly on GitHub

### Xcode version

14.2

### Facebook iOS SDK version

16.1.3

### Dependency Manager

CocoaPods

### SDK Framework

Login

### Goals

I am trying to update my apps and after I release to test flight it is crashing. Debugging the crash log and this is what I have found

Also find screenshot for reference
Screenshot 2023-10-20 at 6 47 04 PM

Video issue

https://github.com/facebook/facebook-ios-sdk/assets/34439120/1b0b5178-a932-470b-b105-6a143bd7805e

### Expected results

It should not crash when initialising Facebook SDK. If I remove below line from AppDelegate.m, it works fine.

[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];

But then, I have to remove Facebook login from my app.

### Actual results

Currently app is crashing with below crash log, this crash is happening at initial launch as shown in video.

FBSDKCoreKit_Basics
+[FBSDKBasicUtility _convertObjectToJSONObject:invalidObjectHandler:stop:] FBSDKBasicUtility.m:128
FBSDKCoreKit_Basics
+[FBSDKBasicUtility _convertObjectToJSONObject:invalidObjectHandler:stop:] FBSDKBasicUtility.m:120
FBSDKCoreKit_Basics
+[FBSDKBasicUtility JSONStringForObject:error:invalidObjectHandler:] FBSDKBasicUtility.m:59
FBSDKCoreKit
-[FBSDKAppEventsUtility activityParametersDictionaryForEvent:shouldAccessAdvertisingID:userID:userData:] FBSDKAppEventsUtility.m:127
FBSDKCoreKit
-[FBSDKAppEvents publishInstall] FBSDKAppEvents.m:866
FBSDKCoreKit
-[FBSDKAppEvents fetchServerConfiguration:] FBSDKAppEvents.m:1023
FBSDKCoreKit
-[FBSDKServerConfigurationManager _didProcessConfigurationFromNetwork:appID:error:] FBSDKServerConfigurationManager.m:387
FBSDKCoreKit
-[FBSDKServerConfigurationManager processLoadRequestResponse:error:appID:] FBSDKServerConfigurationManager.m:281
FBSDKCoreKit
-[FBSDKGraphRequestPiggybackManager addServerConfigurationPiggyback:] FBSDKGraphRequestPiggybackManager.m:178
FBSDKCoreKit
-[FBSDKGraphRequestMetadata invokeCompletionHandlerForConnection:withResults:error:] FBSDKGraphRequestMetadata.m:32
FBSDKCoreKit
-[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:] FBSDKGraphRequestConnection.m:998
FBSDKCoreKit
-[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:] FBSDKGraphRequestConnection.m:1032
FBSDKCoreKit
-[FBSDKGraphRequestConnection _completeWithResults:networkError:] FBSDKGraphRequestConnection.m:981
CoreFoundation
__NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__

### Steps to reproduce

We have an existing Facebook developer id that is causing this issue. We are not sure if this will happen for new developers who are going to integrate Facebook in their app. We are using Objective-c file for App Delegate.

### Code samples & details

```swift
// INSERT YOUR CODE HERE
var example = "Example code"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.