ShoutSocial / share_handler

A plugin to facilitate receiving and handling share intents
42 stars 39 forks source link

ios: Undefined symbol: async function pointer to share_handler_ios_models.ShareHandlerIosViewController #17

Closed jimmyff closed 2 years ago

jimmyff commented 2 years ago

Hi, i'm migrating from receive_sharing_intent

When I try to build my app I get the following build errors:

Undefined symbol: async function pointer to share_handler_ios_models.ShareHandlerIosViewController.(handleText in _E48DB9355F792D6AF47E6D0E54D5F698)(content: __C.NSExtensionItem, attachment: __C.NSItemProvider, index: Swift.Int) async throws -> ()
Undefined symbol: async function pointer to share_handler_ios_models.ShareHandlerIosViewController.(handleFiles in _E48DB9355F792D6AF47E6D0E54D5F698)(content: __C.NSExtensionItem, attachment: __C.NSItemProvider, index: Swift.Int) async throws -> ()
Undefined symbol: async function pointer to share_handler_ios_models.ShareHandlerIosViewController.(handleUrl in _E48DB9355F792D6AF47E6D0E54D5F698)(content: __C.NSExtensionItem, attachment: __C.NSItemProvider, index: Swift.Int) async throws -> ()
Undefined symbol: async function pointer to share_handler_ios_models.ShareHandlerIosViewController.(handleImages in _E48DB9355F792D6AF47E6D0E54D5F698)(content: __C.NSExtensionItem, attachment: __C.NSItemProvider, index: Swift.Int) async throws -> ()
Undefined symbol: async function pointer to share_handler_ios_models.ShareHandlerIosViewController.(handleVideos in _E48DB9355F792D6AF47E6D0E54D5F698)(content: __C.NSExtensionItem, attachment: __C.NSItemProvider, index: Swift.Int) async throws -> ()
Undefined symbol: async function pointer to share_handler_ios_models.ShareHandlerIosViewController.(handleData in _E48DB9355F792D6AF47E6D0E54D5F698)(content: __C.NSExtensionItem, attachment: __C.NSItemProvider, index: Swift.Int) async throws -> ()

Any guidance would be really appreciated.

Thanks!

shawoozy commented 2 years ago

Same issue here

benPesso commented 2 years ago

Did you try flutter clean and deleting the ~/Library/Developer/Xcode/DerivedData/ folder? It's likely that you just have old Pod data.

shawoozy commented 2 years ago

okey I got it to work, thx @benPesso So this library requires IOS 14, but I refactored the swift code to run on older IOS versions and that also seems to work!

JoshJuncker commented 2 years ago

@sharokh1 What code did you refactor to work on older versions? Also, was it just a flutter clean and deleting derived data that got rid of the 'Undefined symbol...' errors? I have a friend who is getting those errors on his project, but not on the example project, and those steps didn't seem to help him. In the end, he reverted back to copy and pasting all of the view controller code directly into his share view controller rather than inheriting from the view controller in the module.

shawoozy commented 2 years ago

@JoshJuncker so there are three things

I'm curious if this will solve the problem of your friend.

edit: the code refactor I mentioned earlier made it so the files were not properly read in flutter 😢

benPesso commented 2 years ago
  • set the iOS version to 14 in both targets

I'm not sure if this is relevant, as mine are set to target v12.

shawoozy commented 2 years ago

then how does it work for you ? the whole swift controller has @available(iOS 14.0, *)

try to run it on a device which is running iOS 13 or below

benPesso commented 2 years ago

Sorry, meant to say 13... platform :ios, '13.0'

shawoozy commented 2 years ago

That would not matter, as the share extension controller only works on iOS 14+ that is why I'm asking you to try to run your app on a device/simulator with iOS 13 or below. My expectation is that the share functionality will not work.

benPesso commented 2 years ago

I was going by what you said and referred to the fact that the constraint was not necessary for the build to succeed. I wouldn't know to speculate what devices it would run on or not (and I don't have an iOS device with a version old enough to test).