Alamofire: How to use Alamofire 4.0(swift3.0) on IOS8

Created on 14 Sep 2016  路  10Comments  路  Source: Alamofire/Alamofire

How to use Alamofire 4.0(swift3.0) on IOS8?
my app's Deployment Target is 8.0,but i want use swift3.0 and Alamofire.how can i do?

support

Most helpful comment

Since Swift 3 is compatible with iOS 8, I do not understand why Alamofire made iOS 9 the minimum deploy target. Seems like a mistake.

All 10 comments

From the 4.0 Migration Guide;

iOS and tvOS 9.0+, macOS 10.11.0+, watchOS 2.0+
Xcode 8.0+
Swift 3.0+

For those of you that would like to use Alamofire on iOS 8 or macOS 10.9, please use the latest tagged 3.x release which supports both Swift 2.2 and 2.3.

So there is no Alamofire version that supports both, iOS 8 and Swift 3.0?

Since Swift 3 is compatible with iOS 8, I do not understand why Alamofire made iOS 9 the minimum deploy target. Seems like a mistake.

You can find a full explanation of the decision to drop older iOS and macOS version in issue #1367.

If you wish to use Xcode 8 and Alamofire while targeting iOS 8, please use Alamofire 3.5.0 and Swift 2.3.

I'm trying to do exactly the above Xcode 8, Alamofire 3.5.0 via Cocoapods, set 'use legacy swift version' to yes and I get:

sanitize=address' is not supported on the Swift 2.3 toolchain

Any ideas please?

Please ignore that. It seems I had to turn off address sanitiser within the scheme to get it to compile.

@yn288163 For Swift 3, you can use this https://github.com/onmyway133/Alamofire/tree/fix/ios_8. I removed the stream delegate

Target IOS 8, you can try this, https://github.com/tonyli508/AlamofireDomain

I can use Alamorfire 4.0 with swift 3 and iOS8+ by use submodule:

Manually
If you prefer not to use either of the aforementioned dependency managers, you can integrate Alamofire into your project manually.

Embedded Framework

Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:

$ git init
Add Alamofire as a git submodule by running the following command:

$ git submodule add https://github.com/Alamofire/Alamofire.git
Open the new Alamofire folder, and drag the Alamofire.xcodeproj into the Project Navigator of your application's Xcode project.

It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.
Select the Alamofire.xcodeproj in the Project Navigator and verify the deployment target matches that of your application target.

Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
In the tab bar at the top of that window, open the "General" panel.
Click on the + button under the "Embedded Binaries" section.
You will see two different Alamofire.xcodeproj folders each with two different versions of the Alamofire.framework nested inside a Products folder.

It does not matter which Products folder you choose from, but it does matter whether you choose the top or bottom Alamofire.framework.
Select the top Alamofire.framework for iOS and the bottom one for OS X.

You can verify which one you selected by inspecting the build log for your project. The build target for Alamofire will be listed as either Alamofire iOS, Alamofire macOS, Alamofire tvOS or Alamofire watchOS.
And that's it!

The Alamofire.framework is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.

Was this page helpful?
0 / 5 - 0 ratings