Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ylj798 opened this issue Sep 19, 2015 · 16 comments
Assignees
Labels

Comments

@ylj798
Copy link

ylj798 commented Sep 19, 2015

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~!

@ylj798
Copy link
Author

ylj798 commented Sep 19, 2015

fixed it

@cnoon cnoon added the support label Sep 19, 2015
@cnoon cnoon self-assigned this Sep 19, 2015
@cnoon cnoon closed this as completed Sep 19, 2015
@ozgur
Copy link

ozgur commented Sep 23, 2015

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

@mojtabacazi
Copy link

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

@andrewschreiber
Copy link

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

@mojtabacazi
Copy link

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

@andrewschreiber
Copy link

Perhaps a 'pod install'

@mojtabacazi
Copy link

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

@ylj798
Copy link
Author

ylj798 commented Sep 25, 2015

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
Copy link

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

@erikvdwal
Copy link

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
Copy link

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
Copy link

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

@geoherna
Copy link

geoherna commented Mar 23, 2016

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
Copy link

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

@davidbjames
Copy link

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
Copy link

arjun011 commented Jul 5, 2016

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
Labels
Projects
None yet
Development

No branches or pull requests