无法在swift中获取关于didExitRegion的视图

时间:2016-03-03 14:28:03

标签: swift cllocationmanager jsqmessagesviewcontroller

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

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)
        }

    }

0 个答案:

没有答案