4.5 C
New York
Thursday, December 12, 2024

ios – Subject with Share Element utilizing Expo and React


I am making an attempt to implement sharing from the gallery for my app and utilizing the next part
https://ajith-ab.github.io/react-native-receive-sharing-intent

It really works nice with android however I am getting an error with ios fairly tough to resolve:

in AppDelegate.mm
I’ve

    // Linking API
- (BOOL)software:(UIApplication *)software openURL:(NSURL *)url choices:(NSDictionary *)choices  [RCTLinkingManager application:application openURL:url options:options];

In ShareViewController.swift

I’ve

  non-public func redirectToHostApp(kind: RedirectType) {
   let url = URL(string: "(shareProtocol)://dataUrl=(sharedKey)#(kind)")
   var responder = self as UIResponder?
   let selectorOpenURL = sel_registerName("openURL:")
   
   whereas (responder != nil) {
     if (responder?.responds(to: selectorOpenURL))! {
       let _ = responder?.carry out(selectorOpenURL, with: url)
     }
     responder = responder!.subsequent
   }
   extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
 }

However I am getting the next error:

BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(_:) must migrate to the non-deprecated UIApplication.open(_:choices:completionHandler:). Pressure returning false (NO).

Is one thing deprecated?
Any tip to rewrite it?

I’ve tried an answer discovered right here
Share Extension to open containing app

and tailored mu perform like bellow

  non-public func redirectToHostApp(kind: RedirectType) {
    let url = URL(string: "(shareProtocol)://dataUrl=(sharedKey)#(kind)")
    
    if url != nil {
      var responder = self as UIResponder?
      
      whereas responder != nil {
        if let software = responder as? UIApplication {
          if #out there(iOS 18.0, *) {
            software.open(url!, choices: [:], completionHandler: nil)
          } else {
            software.carry out(#selector(openURL(_:)), with: url)
          }
        }
        responder = responder?.subsequent
      }
    }
    extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
  }

and getting then the error

Didn't open URL ShareMedia://dataUrl=ShareKey#media: Error Area=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=279, _LSFunction=-[_LSDOpenClient openURL:fileHandle:options:completionHandler:]}

Not fairly certain how you can troubleshoot from this level

Thanks for any course you possibly can present

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles