I was using the previous version of Alamofire in beta 5 of Xcode. Today I uninstalled beta 5, installed beta 6 and deleted the old Alamofire file and added the latest one.
But I get this error wherever I have used Alamofire.
Use of unresolved identifier 'Alamofire'
I cleaned and built the project several times. Restarted the Mac but no avail. Does anyone else facing this issue?
If you look at the code change the AlamoFire struct was removed, so if you were using AlamoFire.request just use "request".
Looks like we're going to have to include Alamofire in our projects as a framework. I downloaded the ZIP and tried adding the Alamofire framework in "linked frameworks and libraries" and "target dependencies" but the linker is failing. Not sure if there's an official plan for Swift Cocoapods but I hope so. Instructions for including the framework would be helpful in the meantime.
Frameworks are only available in iOS 8, right? So to use Alamofire like we used until now (Alamofire.request()
) we'd need to require iOS 8.
I don't get how you're supposed to use it as a framework?
I added several .framework
dependencies in my project and it worked fine, but the README
here calls for a .xcodeproj
file. Dragging it didn't make it work. Any idea?
In the meantime I just added the source file and remove the Alamofire.
in my sources.
The example project is built with Alamofire as a framework. You can use that as a reference if you need more clarification on installation.
In case anyone hasn't figured it out yet. Once you drag the Alamofire.xcodeproj
into your project go to your project target >> "Build Phases" under "Target Dependencies" press +
and add the framework.
As for supporting iOS 7; I found it easy to change Alamofire's "Deployment Target" to iOS 7. I haven't really found a bug in doing this yet. This may be the cause of some errors if your project deploys with iOS 7.
Thanks, @angelcasado.
@angelcasado I dragged and dropped the Alamofire.xcodeproj to my project, added the framework as a Target Dependency but still it doesn't work. And here's the kicker! When I build it, it fails without an error!
I have no idea why Alamorefire.framework is showing in red either.
@mattt Is adding it as a framework the only option to add Alamofire to a project? Can't we just add the file like it used to be anymore?
@Isuru-Nanayakkara I just spent an embarrassing amount of time trying to get things working as a framework...finally realized that I didn't add "import Alamofire" into my Swift classes.
@luketheobscure Thanks, Luke. I finally managed to integrate it successfully.
Thanks @angelcasado, @luketheobscure !
@luketheobscure Thanks, you are a life saver!
@luketheobscure @mattt forgot to import Alamofire into my class. _face palm_
I am getting the same error. I followed all the steps but I was not sure about this step, I probably did something wrong because I don't see this "Targets" option in the side nav:
In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
I do not see the "Targets" heading in the sidebar. Where is this?
The attached screenshot is what it currently looks like. You can see the framework is red, which to me implies that there was a build problem for the framework.
@mattcantstop You need to add the Alamofire.framework to the Target Dependencies, not Link Binary with Libraries,.
Ah, thanks. Overlooked that this go round.
@Isuru-Nanayakkara - :+1: Adding to Target Dependencies fixed it, Thanks! And step 6 on the read me should be changed.
I just assumed I misread it @adooylabs. I can submit a pull request to make that change if people want.
@mattcantstop - Sounds like a good idea. :+1:
In my case, if this helps anyone, I found myself with Alamofire added in both places, Target Dependencies and Link Binaries With Libraries. And the error only went away once I removed it from Link Binary.
Great angelcassado
Most helpful comment
@Isuru-Nanayakkara I just spent an embarrassing amount of time trying to get things working as a framework...finally realized that I didn't add "import Alamofire" into my Swift classes.