0

当用户退出我定义的地理围栏时。函数中的所有其他代码都会按预期触发,但视图不会关闭。有什么建议么?

func locationManager(manager: CLLocationManager, didExitRegion region: CLRegion) {
    let defaults = NSUserDefaults.standardUserDefaults()
    defaults.setBool(false, forKey: self.userCheckInKey)
    ProgressHUD.showError("You are no longer checked-in")
    //self.performSegueWithIdentifier("unwindToMainScreen", sender: self)

    self.dismissViewControllerAnimated(true, completion: nil)
}

另请注意,我正在使用 JSQMessages 库,此视图是 JSQMessagesView

import UIKit
import Foundation
import AVKit
import AVFoundation


class LocalMessagesViewController: JSQMessagesViewController, UIActionSheetDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, CLLocationManagerDelegate

更新功能:

func locationManager(manager: CLLocationManager, didExitRegion region: CLRegion) {
        let defaults = NSUserDefaults.standardUserDefaults()
        defaults.setBool(false, forKey: self.userCheckInKey)

        dispatch_async(dispatch_get_main_queue()) {
            ProgressHUD.showError("You are no longer checked-in")
            self.dismissViewControllerAnimated(true, completion: nil)
        }

    }
4

0 回答 0