I am pretty new to coding, but working on a flutter app and trying to integrate the ability to share images to Instagram Stories using the Social Share package. Everything works fine to generate the photo and the dynamic link (can test by commenting out the SocialShare part), but when the app tried to open Instagram on iOS I am getting the following error
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
Image is generated using
final newImage = await _socialShareService.sharedImage();
//then image is saved to Firebase and dynamic link generated
final postsUpdateData = createPostsRecordData(
sharedImage: newImage);
await containerPostsRecord.reference.update(
postsUpdateData);
var uri = await _dynamicLinkService
.createDynamicLink()
print(uri.toString());
//this is where the error is occurring
await SocialShare.shareInstagramStory(newImage,
backgroundBottomColor: "#000000",
backgroundTopColor: "#ffffff",
attributionURL: uri.toString());
I am having trouble understanding the error to figure out what is being called on nil. Full error message is below
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x180e350fc 0x199685d64 0x180f3e564 0x180f496e0 0x180df2514 0x180e10ebc 0x101d6c0a4 0x10507a75c 0x104bb3cf8 0x104f41bb4 0x104e691c0 0x104e6cf24 0x180e4a318 0x180dcecf0 0x180dc94ec 0x180da7d08 0x180dbb468 0x19c95f38c 0x18375e5d0 0x1834dcf74 0x100a1fb68 0x101589aa4)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00000001b84f7964 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
-> 0x1b84f7964 <+8>: b.lo 0x1b84f7984 ; <+40>
0x1b84f7968 <+12>: pacibsp
0x1b84f796c <+16>: stp x29, x30, [sp, #-0x10]!
0x1b84f7970 <+20>: mov x29, sp
Target 0: (Runner) stopped.
I know the error is coming from the AppDelegate.swift function, but I am not sure exactly how to solve this. Any insight is greatly appreciated!
UPDATED: Info.plist does include facebook and instagram.
<key>FacebookAppID</key>
<string>xxxxxxxxxxxxx</string>
<key>FacebookDisplayName</key>
<string>name</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbauth</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>instagram-stories</string>
<string>facebook-stories</string>
<string>facebook</string>
<string>instagram</string>
<string>twitter</string>
<string>whatsapp</string>
</array>