Alamofire / Swift2:初始化变量以防万一.Success回调抛出EXC_BAD_INSTRUCTION?

时间:2015-09-29 13:20:25

标签: ios afnetworking swift2 alamofire

        Alamofire.request(.POST, endpoint, parameters: params)
    .responseJSON { request, response, result in

        switch result {
            case .Success(let json):
            var customerData:[String:AnyObject] = [String:AnyObject]()
// throws: Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

如果我在请求之外声明var并尝试设置customerData["whatever"] = "some value"

,我会收到相同的错误

1 个答案:

答案 0 :(得分:-1)

请检查此代码。

$(document).ready(function(){


   $('#wayfindermenu a').click(function(e){
     hideContentDivs();
     var tmp_div = $(this).parent().index();
     $('.maincontent div').eq(tmp_div).show();
  });

function hideContentDivs(){
    $('.maincontent div').each(function(){
    $(this).hide();});
}
hideContentDivs();
});

var selector = '#wayfindermenu li';

$(selector).on('click', function(){
    $(selector).removeClass('active');
    $(this).addClass('active');
});

它在Playground xcode 7.1 beta中运行良好