HomeiOS Developmentios - Once I share a video to reels instagram from my...

ios – Once I share a video to reels instagram from my app, I can not monitor the standing of the publish to activate one other function


I am asking for assist, I am making an attempt to implement the perform of publishing movies from my software to different platforms, to replenish the interior stability
Drawback with rail instagram : After a profitable publication, the exercise controller goes into the beginning state and my software doesn’t know that the rail has been revealed, due to this, cash aren’t awarded for this kind of publication, for the reason that completionWithItemsHandler technique doesn’t work

right here is my share perform:

   @objc func shareData(sender: UIButton){
        self.shareVideoForIndex(index: sender.tag)
   }

    func shareVideoForIndex(index : Int){
        let videoData = videoSearchData[index]
        let fileID = videoData.video_ID
        let videoURL = URL.videoMixesDir.appendingPathComponent(videoData.video_URL)
        let isAlreadyShared = videoData.isAlreadyPostOnSocial
        
        let shareAll: [URL] = [videoURL]
        let arrayOfItem = shareAll.map { url in
            ShareItem(url: url , title: "")
        }
    
        let activityViewController = UIActivityViewController(activityItems: arrayOfItem, applicationActivities: nil)
        activityViewController.setValue("Video", forKey: "topic")
        activityViewController.completionWithItemsHandler = {
            activityType, accomplished, returnedItems, error in
                if accomplished && (error == nil) {
                    Analytics.logEvent("did_tap_share_button", parameters: ["type": activityType?.rawValue as Any])
                if activityType == UIActivity.ActivityType.postToFacebook ||
                    activityType == UIActivity.ActivityType.postToTwitter ||
                    activityType == UIActivity.ActivityType("com.burbn.instagram.shareextension") ||
                    activityType == UIActivity.ActivityType("com.burbn.youtube.shareextension") {
                    
                    if activityType == UIActivity.ActivityType("com.burbn.instagram.shareextension"){
                        let asset = AVAsset(url: videoURL)
                        let period = asset.period.seconds
                        if !(period < 60){
                            return
                        }
                    }
                   
                    if !isAlreadyShared {
                        let totalCoin = self.keyChain.get(CoinsStoreController.coinsKey) ?? ""
                        var IntCoin = Int(totalCoin) ?? CoinsStoreController.premiumMixCost * 3
                        IntCoin = IntCoin + 25
                        self.keyChain.set("(IntCoin)", forKey: CoinsStoreController.coinsKey, withAccess: .none)
                        DataBaseVideoRecord.shareInstance.updateVideoDataForSharedStatus(
                            videoID: fileID,
                            sharedStatus: true
                        )
                        DispatchQueue.foremost.async {
                            let alertController = UIAlertController(
                                title: "",
                                message: "You simply earned 25 bonus cash!",
                                preferredStyle: .alert
                            )
                            self.navigationController?.current(alertController, animated: true) {
                                DispatchQueue.foremost.asyncAfter(deadline: .now() + 6.0) {
                                    alertController.dismiss(animated: true, completion: nil)
                                }
                            }
                        }
                    }
                }
            }
        }
        activityViewController.popoverPresentationController?.sourceView = self.view
        self.current(activityViewController, animated: true, completion: nil)
    
    }

A standard publish, sms or story closes the exercise controller by itself and every thing works, however not reels
Is there a technique to monitor the reels publish to inform my app that the publish has been revealed?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments