无法追查错误原因:_OBJC_CLASS _ $ _ SLComposeViewController

时间:2016-08-23 16:43:29

标签: ios swift2

我最近收到此错误,我也不知道为什么会发生这种错误据我所知,我的ViewController中最近没有任何更改错误指向错误 我跟着一个类似的问题并根据那个问题回答我的框架没有正确地链接到我的项目中,这在我的情况下是不正确的,我仔细检查了它和(框架社交& messageUI)奇怪的是这个错误只有在我试图在模拟器上运行我的项目时才会提高,当我在真实设备中运行它时工作正常。有人遇到类似的事吗?我知道怎么解决这个问题?那么请告诉我

  ld: warning: ignoring file /Users/user1/Desktop/mypackage 2.0/IOS/mypackage/Social.framework/Social.tbd, missing required architecture x86_64 in file /Users/user1/Desktop/mypackage 2.0/IOS/mypackage/Social.framework/Social.tbd
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SLComposeViewController", referenced from:
      type metadata accessor for __ObjC.SLComposeViewController in SettingTableViewController.o
  "_SLServiceTypeFacebook", referenced from:
      mypackage.SettingTableViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -> ()).(closure #4) in SettingTableViewController.o
  "_SLServiceTypeTwitter", referenced from:
      mypackage.SettingTableViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -> ()).(closure #5) in SettingTableViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的VC我在哪里使用这个社交API

      if indexPath.row == 3 {

        //Create the AlertController
        let actionSheetController: UIAlertController = UIAlertController(title: "", message: "Share with your friends", preferredStyle: .ActionSheet)

        //Create and add the Cancel action
        let cancelAction: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -> Void in
            //Just dismiss the action sheet
        }
        actionSheetController.addAction(cancelAction)
        //Create and add first option action
        let shareEmailAction: UIAlertAction = UIAlertAction(title: "Email", style: .Default)
        { action -> Void in

            // Email Subject
            let emailTitle: String = "Great new tool"
            // Email Content
            let messageBody: String = self.inviteTextBody
            // To address
            let toRecipents: [String] = [""]
            let mc: MFMailComposeViewController = MFMailComposeViewController()
            mc.mailComposeDelegate = self
            mc.setSubject(emailTitle)
            mc.setMessageBody(messageBody, isHTML: false)
            mc.setToRecipients(toRecipents)
            // Present mail view controller on screen
            self.presentViewController(mc, animated: true, completion: { _ in })

            if !MFMailComposeViewController.canSendMail() {
                let alertView = UIAlertView(title: "Error", message: "Mail services are not available, Please try again later.", delegate: self, cancelButtonTitle: "OK")
                alertView.show()
                return

            }

        }
        actionSheetController.addAction(shareEmailAction)
        //Create and add a second option action
        let shareWhatsappAction: UIAlertAction = UIAlertAction(title: "Whatsapp", style: .Default)
        { action -> Void in


            let escapedString = self.inviteTextBody.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())


            let whatsappURL:NSURL? = NSURL(string: "whatsapp://send?text=\(escapedString!)")


            if (UIApplication.sharedApplication().canOpenURL(whatsappURL!)) {

                UIApplication.sharedApplication().openURL(whatsappURL!)
            }

        }
        actionSheetController.addAction(shareWhatsappAction)


        let shareWithFBAction: UIAlertAction = UIAlertAction(title: "Facebook", style: .Default)
        { action -> Void in

            //self.performSegueWithIdentifier("segue_setup_provider", sender: self)
            if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook){
                let facebookSheet:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
                facebookSheet.setInitialText(self.inviteTextBody)
                self.presentViewController(facebookSheet, animated: true, completion: nil)
            } else {
                let alert = UIAlertController(title: "Accounts", message: "Please login to a Facebook account to share.", preferredStyle: UIAlertControllerStyle.Alert)
                alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
                self.presentViewController(alert, animated: true, completion: nil)
            }
        }
        actionSheetController.addAction(shareWithFBAction)

        let shareWithTwitterAction: UIAlertAction = UIAlertAction(title: "Twitter", style: .Default)
        { action -> Void in

            //self.performSegueWithIdentifier("segue_setup_provider", sender: self)

            if SLComposeViewController.isAvailableForServiceType(SLServiceTypeTwitter){
                let twitterSheet:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeTwitter)
                twitterSheet.setInitialText(self.inviteTextBody)
                self.presentViewController(twitterSheet, animated: true, completion: nil)
            } else {
                let alert = UIAlertController(title: "Accounts", message: "Please login to a Twitter account to share.", preferredStyle: UIAlertControllerStyle.Alert)
                alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
                self.presentViewController(alert, animated: true, completion: nil)
            }

        }
        actionSheetController.addAction(shareWithTwitterAction)


        let shareWithSMSAction: UIAlertAction = UIAlertAction(title: "SMS", style: .Default)
        { action -> Void in


            if (MFMessageComposeViewController.canSendText()) {
                let controller = MFMessageComposeViewController()
                controller.body = self.inviteTextBody
                controller.messageComposeDelegate = self
                self.presentViewController(controller, animated: true, completion: nil)
            }
            //self.performSegueWithIdentifier("segue_setup_provider", sender: self)

        }
        actionSheetController.addAction(shareWithSMSAction)

        let cell = self.tableView(tableView, cellForRowAtIndexPath: indexPath)
        //We need to provide a popover sourceView when using it on iPad
        actionSheetController.popoverPresentationController?.sourceView = cell as UIView

        //Present the AlertController
        self.presentViewController(actionSheetController, animated: true, completion: nil)
    }

enter image description here

0 个答案:

没有答案