Skip to content

Alamofire was compiled with optimization - stepping may behave oddly; variables may not be available. #790

@ylj798

Description

@ylj798

when I use Alamofire2.0,run app ,this is error occurred:

Alamofire was compiled with optimization - stepping may behave oddly; variables may not be available

Xcode pointed to Alamofire.swift,line number 92
who can help me?
Thanks~!

Activity

ylj798

ylj798 commented on Sep 19, 2015

@ylj798
Author

fixed it

self-assigned this
on Sep 19, 2015
ozgur

ozgur commented on Sep 23, 2015

@ozgur

@cnoon how did you fix this? can you help me out. I have the same issue.

mojtabacazi

mojtabacazi commented on Sep 24, 2015

@mojtabacazi

Same problem here. Any idea? @mattt
I've checked complier setting and optimizer is set NONE

andrewschreiber

andrewschreiber commented on Sep 24, 2015

@andrewschreiber

I ran into the same issue in ReactiveCocoa and running 'carthage build' fixed the problem.

mojtabacazi

mojtabacazi commented on Sep 24, 2015

@mojtabacazi

@andrewschreiber I'm using Cocoapods. Any solution for that?

andrewschreiber

andrewschreiber commented on Sep 24, 2015

@andrewschreiber

Perhaps a 'pod install'

mojtabacazi

mojtabacazi commented on Sep 25, 2015

@mojtabacazi

@andrewschreiber I've tried pod install several time. Removed pods completely and add them back. nothing is working.

ylj798

ylj798 commented on Sep 25, 2015

@ylj798
Author

Sorry,I just see the email,Now,how to the error was solved,

TARGETS->Build Phases->Embed Frameworks
when you add the framework of Alamofire2.0,
Xcode will take three frameworks,iphoneos ,xos,watchos,
please delete the xos,watchos,save the iphoneos,
when you run the app,the error was solved~!!
Happy Mid Autumn Festival

mojtabacazi

mojtabacazi commented on Sep 25, 2015

@mojtabacazi

@ylj798 I can't see "Embed Frameworks". BTW, I think I'm in the wrong thread, I'm using AFNetworking not Alamofire

erikvdwal

erikvdwal commented on Sep 28, 2015

@erikvdwal

This problem seems to (also) occur when you try to construct a url using optionals:

let username: String? = "mattt"
let request = Alamofire.request(.GET, "http://localhost/user/\(username)").responseJSON { response in
    // ...
}

The solution is obvious; make sure you unwrap any optionals using guard, if-let or by implicitly unwrapping them before constructing your url.

My guess is that Carthage builds the Alamofire framework with the Release configuration (by default) for which optimizations are enabled, which results in the error message mentioned in the initial post instead of a more descriptive message. Could be wrong about this though ¯_(ツ)_/¯

29satnam

29satnam commented on Sep 30, 2015

@29satnam

Same error, PUT isn't working

let parameters = ["briefDes": briefDes.text, "jobDetail": detail.text, "skill": skillsTF.text]
Alamofire.request(.PUT, "http://localhost:2403/postedjob?id=\(jobId.text)", parameters: parameters)

error: Alamofire was compiled with optimization - stepping may behave oddly; variables may not be available.

Update:
Issue solved.! jobId.text wasn't unwrapped. :)

jakubprusa

jakubprusa commented on Nov 12, 2015

@jakubprusa

@29satnam life saver !!!, unwraping was also my issue with different library :)

geoherna

geoherna commented on Mar 23, 2016

@geoherna

Just incase anyone else is getting: error: Alamofire was compiled with optimization - stepping may behave oddly; variables may not be available.

I was getting that error when constructing a URL for google geo services. I was appending a street address to the end of the URL WITHOUT encoding the street address itself first.
My Solution:

var streetAdress = "123 fake street, new york, ny"
var escapedStreetAddress = streetAddress.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())
let url = "(self.baseUrl)&address=(escapedAddress!)"

That fixed it for me! It didnt like that the address had spaces and commas, etc.

Hope this helps someone else!

ramrumram

ramrumram commented on May 11, 2016

@ramrumram

man geoherna, you nailed it, yes there was a trailing space in input and your way worked...

davidbjames

davidbjames commented on May 19, 2016

@davidbjames

You got it @geoherna. We had server-provided media URLs with spaces in them, so this fixed it :

NSURL(string: unsafeUrlString.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.whitespaceCharacterSet().invertedSet))
arjun011

arjun011 commented on Jul 5, 2016

@arjun011

hi friends i have fetch same problem "Alamofire was compiled with optimization - stepping may behave oddly; variables may not be available."
But , I was Fixed it Check your url string Pass Url Without any SPACE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @ozgur@erikvdwal@cnoon@ylj798@mojtabacazi

      Issue actions

        Alamofire was compiled with optimization - stepping may behave oddly; variables may not be available. · Issue #790 · Alamofire/Alamofire