Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
874 views
in Technique[技术] by (71.8m points)

ios - How to solve this EXC_BAD_ACCESS(code=EXC_i386_GPFLT )in swift programming

this is my code.getting this EXC_BAD_ACCESS(code=EXC_i386_GPFLT).I don'n know how to find and solve plz help me ...application getting crash when get longitude

mapServerRequest="Hyderabad,india"
var mapAddress:NSString=mapServerRequest
mapAddress.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLPathAllowedCharacterSet())
     println(mapAddress)
var urlpath=NSString(format: "http://maps.googleapis.com/maps/api/geocode/json?address=%@", mapAddress)
     println(urlpath)
var url = NSURL.URLWithString(urlpath)
    println(url)
var jsonData:NSData=NSData(contentsOfURL:url)

       if(jsonData != nil)
    {
        var error:NSError=NSError(coder: nil)
        var result:NSDictionary=NSJSONSerialization .JSONObjectWithData(jsonData, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
        //println(result)
        if (error != nil)
        {
            mapServerResultArray=result.valueForKey("results") as NSMutableArray
           // println(mapServerResultArray)

        }
      var longitud:NSString

           longitud=mapServerResultArray.objectAtIndex(0).valueForKey("geometry").valueForKey("location").valueForKey("lng")as NSString

        var latitud :NSString = (mapServerResultArray .objectAtIndex(0).valueForKey("geometry").valueForKey("location").valueForKey("lat")) as NSString
        placeName=mapServerResultArray .objectAtIndex(0).valueForKey("formatted_address") as NSString
        var longitude:Float=longitud.floatValue
        var latitude:Float=latitud.floatValue
        self.zoomMapAndCenterAtLatitude(latitude)
        self.zoomMapAndCenterAtLongitud(longitude) 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Short answer:

enable Zombies in the Scheme and it will enable a breakpoint and proper reason will be displayed in the logs

Technical reason:

You are trying to do something which in not allowed in the architecture refer this What's the meaning of exception code "EXC_I386_GPFLT"?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...