profile
viewpoint
Alamofire Alamofire http://alamofire.org Elegant Networking in Swift

startedAlamofire/Alamofire

started time in 17 minutes

startedAlamofire/Alamofire

started time in 6 hours

startedAlamofire/Alamofire

started time in 8 hours

startedAlamofire/Alamofire

started time in 10 hours

fork dehlen/Alamofire

Elegant HTTP Networking in Swift

fork in 15 hours

startedAlamofire/Alamofire

started time in a day

startedAlamofire/AlamofireNetworkActivityIndicator

started time in 2 days

issue openedAlamofire/AlamofireNetworkActivityIndicator

Can't install AlamofireNetworkActivityIndicator

What did you do?

Specified the package version by adding pod 'AlamofireNetworkActivityIndicator', '~> 2.4' to my podfile, then ran pod install

What did you expect to happen?

I expect to install alamofire network activity indicator to use in my project

What happened instead?

Got an error, here is the output

[!] CocoaPods could not find compatible versions for pod "Alamofire":
  In snapshot (Podfile.lock):
    Alamofire (= 5.0.0-rc.3, ~> 5.0.0-rc.3)

  In Podfile:
    Alamofire (~> 5.0.0-rc.3)

    AlamofireNetworkActivityIndicator (~> 2.4) was resolved to 2.4.0, which depends on
      Alamofire (~> 4.8)

Alamofire Environment

Alamofire version: 5.0.0-rc.3 AlamofireNetworkActivityIndicator: 2.4 Xcode version: Version 11.3 (11C29) Swift version: 5 macOS version running Xcode: 10.15.2(19C57)

created time in 2 days

fork sopra-mobile-bcn/Alamofire

Elegant HTTP Networking in Swift

fork in 2 days

startedAlamofire/Alamofire

started time in 2 days

startedAlamofire/Alamofire

started time in 2 days

startedAlamofire/Alamofire

started time in 2 days

startedAlamofire/Alamofire

started time in 2 days

startedAlamofire/AlamofireImage

started time in 2 days

startedAlamofire/Alamofire

started time in 2 days

pull request commentAlamofire/Alamofire

Update AdvancedUsage.md

Ok, updated.

Binlogo

comment created time in 2 days

issue openedAlamofire/Alamofire

I can not find the object ServerTrustPolicy.

Hi everyone, could you please, help me I am using 'Alamofire', '5.0.0-beta.3' and my main task is make to conect via https and use SSl, as I show below I have found the code on the internert, but I could not find object ServerTrustPolicy. Where can I find it.

// Your hostname and endpoint let hostname = "YOUR_HOST_NAME" let endpoint = "YOUR_ENDPOINT" let cert = "YOUR_CERT" // e.g. for cert.der, this should just be "cert"

// Set up certificates let pathToCert = Bundle.main.path(forResource: cert, ofType: "der") let localCertificate = NSData(contentsOfFile: pathToCert!) let certificates = [SecCertificateCreateWithData(nil, localCertificate!)!]

// Configure the trust policy manager let serverTrustPolicy = ServerTrustPolicy.pinCertificates( certificates: certificates, validateCertificateChain: true, validateHost: true )
let serverTrustPolicies = [hostname: serverTrustPolicy] let serverTrustPolicyManager = ServerTrustPolicyManager(policies: serverTrustPolicies)

// Configure session manager with trust policy afManager = SessionManager( configuration: URLSessionConfiguration.default, serverTrustPolicyManager: serverTrustPolicyManager )

afManager.request(endpoint, method: .get).responseJSON { response in debugPrint("All Response Info: (response)") }

created time in 2 days

startedAlamofire/Alamofire

started time in 2 days

pull request commentAlamofire/Alamofire

Update AdvancedUsage.md

This looks good, just needs an update after the recently merged changes.

Binlogo

comment created time in 2 days

push eventAlamofire/Alamofire

Tim

commit sha 247e8ba2c6f01d7ca28d81e262ef123eed2f3e78

Update advanced usage request retry/adapt documention for Alamofire 5 (#3033)

view details

push time in 2 days

PR merged Alamofire/Alamofire

Update Advanced Usage Documentation

Goals :soccer:

Update the advanced usage section of the documentation for Alamofire 5 🎉

Details

It looks like the advanced usage documentation hasn't been updated for Alamofire 5, so I've updated all instances of SessionManager to Session. I've also changed the sample code for RequestInterceptor as I've been working with it so the code compiles with Alamofire 5.

Due to some of the changes in Alamofire 5 (like interceptor being a let) the code may not follow the intended usage. If so, let me know and I'll be happy to change!

+42 -45

1 comment

1 changed file

0xTim

pr closed time in 2 days

pull request commentAlamofire/Alamofire

Update Advanced Usage Documentation

Much of this documentation will be rewritten soon (working on it right now), but I'll merge the changes for now.

0xTim

comment created time in 2 days

startedAlamofire/Alamofire

started time in 2 days

startedAlamofire/Alamofire

started time in 2 days

startedAlamofire/Alamofire

started time in 3 days

startedAlamofire/Alamofire

started time in 3 days

startedAlamofire/Alamofire

started time in 3 days

startedAlamofire/Alamofire

started time in 3 days

startedAlamofire/Alamofire

started time in 3 days

issue commentAlamofire/Alamofire

How to continue download file?

@tiagoaap I'd be very surprised if that delegate method was called when the user manually killed the app.

I'm also surprised because same api was not working for me.

task.cancel()

works.

wgywgy

comment created time in 3 days

startedAlamofire/AlamofireImage

started time in 3 days

fork kafier/Alamofire

Elegant HTTP Networking in Swift

fork in 3 days

startedAlamofire/Alamofire

started time in 3 days

startedAlamofire/Foundation

started time in 3 days

issue commentAlamofire/Alamofire

How to send headers in multipart form

Can you please help me. I have searched a lot but not finding anything on forums.

BHZiva

comment created time in 3 days

issue commentAlamofire/Alamofire

How to send headers in multipart form

This is correct but how should I write it then ? I want to upload multipart with basic auth & header in one request. how to combine all?

I am attaching my postman request for your reference.

Authentication: Screenshot 2020-01-16 at 11 47 58 AM

Header: Screenshot 2020-01-16 at 11 48 02 AM

Body: Screenshot 2020-01-16 at 11 48 07 AM

BHZiva

comment created time in 3 days

startedAlamofire/Alamofire

started time in 3 days

startedAlamofire/Alamofire

started time in 3 days

issue commentAlamofire/Alamofire

request sets "Content-Type" = "text/html automatically

Thank you. I have also faced same type of problem in my web page https://www.assureshift.in/packers-and-movers-navi-mumbai

duraiganesh0

comment created time in 3 days

startedAlamofire/Alamofire

started time in 3 days

PR opened Alamofire/Alamofire

Update AdvancedUsage.md

Add toc for advanced usage document

+35 -1

0 comment

1 changed file

pr created time in 3 days

fork Binlogo/Alamofire

Elegant HTTP Networking in Swift

fork in 3 days

startedAlamofire/Alamofire

started time in 3 days

startedAlamofire/Alamofire

started time in 3 days

fork lanlanguai/Alamofire

Elegant HTTP Networking in Swift

fork in 3 days

issue closedAlamofire/Alamofire

How to send headers in multipart form

Hi,

I have basic auth, headers, and multipart - formdata in body. It's a post request.

Please suggest how to set headers and basic auth.

I have done below part. I am not able to figure out how to add basic auth and headers to this.

AF.upload(multipartFormData: { (multipart) in
            multipart.append(String((APP_DELEGATE.currentUser?.userID)!).data(using: .utf8)!, withName: "uid")
            multipart.append(withData, withName: "file")//, mimeType: "image/jpg")
           }, to: "https://abc.com/updateprofile")
        .uploadProgress(queue: .main, closure: { progress in
            //Current upload progress of file
            print("Upload Progress: \(progress.fractionCompleted)")
        })

closed time in 3 days

BHZiva

issue commentAlamofire/Alamofire

How to send headers in multipart form

The top level multipartFormData APIs accept a headers parameter, as show in our documentation.

BHZiva

comment created time in 3 days

issue commentAlamofire/Alamofire

Deprecation UIWebView

Feel free to check our repo, we don't use it at all.

vcapilladeveloper

comment created time in 3 days

issue openedAlamofire/Alamofire

How to send headers in multipart form

Hi,

I have basic auth, headers, and multipart - formdata in body. It's a post request.

Please suggest how to set headers and basic auth.

I have done below part. I am not able to figure out how to add basic auth and headers to this.

AF.upload(multipartFormData: { (multipart) in
            multipart.append(String((APP_DELEGATE.currentUser?.userID)!).data(using: .utf8)!, withName: "uid")
            multipart.append(withData, withName: "file")//, mimeType: "image/jpg")
           }, to: "https://abc.com/updateprofile")
        .uploadProgress(queue: .main, closure: { progress in
            //Current upload progress of file
            print("Upload Progress: \(progress.fractionCompleted)")
        })

created time in 4 days

fork erkutbas/Alamofire

Elegant HTTP Networking in Swift

fork in 4 days

startedAlamofire/Alamofire

started time in 4 days

startedAlamofire/Alamofire

started time in 4 days

startedAlamofire/AlamofireImage

started time in 4 days

startedAlamofire/Alamofire

started time in 4 days

issue commentAlamofire/Alamofire

Deprecation UIWebView

Hello there, I am investigating this because I am going through the same issue and I have followed this trick :

cd ~/Library/Developer/Xcode/Archives/<date>/myapp.xcarchive/Products/Applications/myapp.app

nm myapp | grep UIWeb
for framework in Frameworks/*.framework; do
  fname=$(basename $framework .framework)
  echo $fname
  nm $framework/$fname | grep UIWeb
done

and Alamofire is one of the libs that appear in the list. How is this possible to be happening if as you say, UIWebView isn't in it?

https://stackoverflow.com/questions/57722616/itms-90809-deprecated-api-usage-apple-will-stop-accepting-submissions-of-app

vcapilladeveloper

comment created time in 4 days

startedAlamofire/Alamofire

started time in 4 days

fork barfoon/Alamofire

Elegant HTTP Networking in Swift

fork in 4 days

fork rjowens/Alamofire

Elegant HTTP Networking in Swift

fork in 4 days

issue closedAlamofire/Alamofire

Authenticate NTLM works with invalid credentials

Hello,

I am having an issue with authenticate NTLM credenitals, when I use valid credentials, it works, but when I use invalid credentials it does not fail, it works as the same as it would with valid credentials. This is only the case when I enter valid credentials first. Is there away to clear the credentials or what am I doing wrong here? Here is my code:

func loginUser(_ username: String, password: String, completion: @escaping (_ result: Bool) -> Void)
    {
        
        let user = username

        let password = password

        let url = webservice

        let credential = URLCredential(user: user, password: password, persistence: .none)

        let headers = ["Accept": "application/json;odata=verbose", "Content-type": "application/json;odata=verbose"]
        
        Alamofire.request(url, method: .get, headers: headers).authenticate(usingCredential: credential).responseJSON {
                (response) in

                print(response.result)
            
                switch response.result {
                    
                case .success:
                    if let value = response.result.value {

                        completion(true)
                    
                    }else{
                        
                        print("There is error in the server response")
                        
                        completion(false)
                    }
                    
                case .failure (let error):
                    
                    print("The NTLM request error is: ", error.localizedDescription)
                    
                    completion(false)
                    
                }

            }
        
    }

closed time in 4 days

jsuske1985

issue commentAlamofire/Alamofire

Authenticate NTLM works with invalid credentials

Fundamentally, you need to investigate whether authentication is actually being performed here, because it's not clear whether that's true or not. NTLM authentication isn't something Alamofire tests specifically, so we rely on the functionality from URLSession. Setting the appropriate break point in Alamofire's handling of authentication challenges, or checking server or proxy logs, would help you determine whether you're actually authenticating at all.

Second, I don't think Alamofire 4 automatically supports NTLM authentication, as it's one of the methods that calls the URLSession delegate method, rather than the task delegate, so there's no way for us to provide the credential. You can get around this by implementing the sessionDidReceiveChallengeWithCompletion closure on the SessionManager, you just need to be careful to copy in the existing code from the delegate to make sure other challenges are handled normally, and provide your credential. Alamofire 5 should handle all of this on a per-Request basis automatically.

Finally, I think StackOverflow is likely your best bet for finding a solution to this issue, so I'm closing it here. If the StackOverflow discussion reveals a larger Alamofire issue, feel free to update this issue with any additional details.

jsuske1985

comment created time in 4 days

issue closedAlamofire/Alamofire

Alamofire 4.7 Ambiguous use of 'Task'

ℹ Please fill out this template when filing an issue. All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.

Per our *CONTRIBUTING guidelines, we use GitHub for bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag alamofire.

Please remove this line and everything above it before submitting.

What did you do?

ℹ Please replace this with what you did.
I needed to rely on Alamofire to pack a cocoa pods library

What did you expect to happen?

ℹ Please replace this with what you expected to happen.
He reported an error when I wrote this:

    open func resume() {
        guard let task = task else { delegate.queue.isSuspended = false ; return }

        if startTime == nil { startTime = CFAbsoluteTimeGetCurrent() }

        task.resume()

        NotificationCenter.default.post(
            name: Notification.Name.Task.DidResume,
            object: self,
            userInfo: [Notification.Key.Task: task]
        )
    }

What happened instead?

I hope it will compile smoothly ℹ Please replace this with of what happened instead.

Alamofire Environment

**Alamofire version:4.7 **Xcode version: 11.3.1 **Swift version:5 **Platform(s) running Alamofire:iOS **macOS version running Xcode:10.15.2

Demo Project

ℹ Please link to or upload a project we can download that reproduces the issue.

issuse report repo

closed time in 4 days

PsChina

issue commentAlamofire/Alamofire

Alamofire 4.7 Ambiguous use of 'Task'

Update to Alamofire 4.9.1, which compiles fine using Xcode 11.3.

PsChina

comment created time in 4 days

issue closedAlamofire/Alamofire

Module 'Alamofire' was not compiled with library evolution support; using it means binary compatibility for 'surfMadly' can't be guaranteed

when I update the Xcode to 11.3, this issue had come, from this many times alamofire not respond.

closed time in 4 days

dilipkumar0803

issue commentAlamofire/Alamofire

Module 'Alamofire' was not compiled with library evolution support; using it means binary compatibility for 'surfMadly' can't be guaranteed

Alamofire doesn't support library evolution for Alamofire 5. We will eventually ship support for v4, as tracked by #2990.

dilipkumar0803

comment created time in 4 days

startedAlamofire/Alamofire

started time in 4 days

issue openedAlamofire/Alamofire

Alamofire 4.7 Ambiguous use of 'Task'

ℹ Please fill out this template when filing an issue. All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.

Per our *CONTRIBUTING guidelines, we use GitHub for bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag alamofire.

Please remove this line and everything above it before submitting.

What did you do?

ℹ Please replace this with what you did.
I needed to rely on Alamofire to pack a cocoa pods library

What did you expect to happen?

ℹ Please replace this with what you expected to happen.
He reported an error when I wrote this:

    open func resume() {
        guard let task = task else { delegate.queue.isSuspended = false ; return }

        if startTime == nil { startTime = CFAbsoluteTimeGetCurrent() }

        task.resume()

        NotificationCenter.default.post(
            name: Notification.Name.Task.DidResume,
            object: self,
            userInfo: [Notification.Key.Task: task]
        )
    }

What happened instead?

I hope it will compile smoothly ℹ Please replace this with of what happened instead.

Alamofire Environment

**Alamofire version:4.7 **Xcode version: 11.3.1 **Swift version:5 **Platform(s) running Alamofire:iOS **macOS version running Xcode:10.15.2

Demo Project

ℹ Please link to or upload a project we can download that reproduces the issue.

[issuse report repo]https://github.com/PsChina/WaykiChainViewController

created time in 4 days

issue commentAlamofire/Alamofire

Ambiguous use of 'Task'

Same here

ososoi

comment created time in 5 days

startedAlamofire/Alamofire

started time in 5 days

startedAlamofire/Alamofire

started time in 5 days

fork SURYAKANTSHARMA/Alamofire

Elegant HTTP Networking in Swift

fork in 5 days

issue openedAlamofire/Alamofire

Module 'Alamofire' was not compiled with library evolution support; using it means binary compatibility for 'surfMadly' can't be guaranteed

when I update the Xcode to 11.3, this issue had come, from this many times alamofire not respond.

created time in 5 days

startedAlamofire/Alamofire

started time in 5 days

fork yantianping/Alamofire

Elegant HTTP Networking in Swift

fork in 5 days

issue commentAlamofire/Alamofire

QUESTION: Background upload on v5

If session no longer supports background configuration, please update the master documentation for advanced usage. Currently there is an example showing how to use URLSessionConfiguration.background(withIdentifier: "...") with old session manager.

githubdoramon

comment created time in 5 days

startedAlamofire/AlamofireImage

started time in 5 days

startedAlamofire/Alamofire

started time in 5 days

startedAlamofire/Alamofire

started time in 5 days

issue openedAlamofire/Alamofire

Authenticate NTLM works with invalid credentials

Hello,

I am having an issue with authenticate NTLM credenitals, when I use valid credentials, it works, but when I use invalid credentials it does not fail, it works as the same as it would with valid credentials. This is only the case when I enter valid credentials first. Is there away to clear the credentials or what am I doing wrong here? Here is my code:

func loginUser(_ username: String, password: String, completion: @escaping (_ result: Bool) -> Void)
    {
        
        let user = username

        let password = password

        let url = webservice

        let credential = URLCredential(user: user, password: password, persistence: .none)

        let headers = ["Accept": "application/json;odata=verbose", "Content-type": "application/json;odata=verbose"]
        
        Alamofire.request(url, method: .get, headers: headers).authenticate(usingCredential: credential).responseJSON {
                (response) in

                print(response.result)
            
                switch response.result {
                    
                case .success:
                    if let value = response.result.value {

                        completion(true)
                    
                    }else{
                        
                        print("There is error in the server response")
                        
                        completion(false)
                    }
                    
                case .failure (let error):
                    
                    print("The NTLM request error is: ", error.localizedDescription)
                    
                    completion(false)
                    
                }

            }
        
    }

created time in 5 days

fork 1fr0st/Alamofire

Elegant HTTP Networking in Swift

fork in 6 days

startedAlamofire/AlamofireImage

started time in 6 days

startedAlamofire/Alamofire

started time in 6 days

push eventAlamofire/Alamofire

Jon Shier

commit sha 021badf66f34c41cadd74e8ff18e09211e81a181

Progress.

view details

push time in 6 days

issue commentAlamofire/Alamofire

Adapting and Retrying Requests for Basic Authentication System

@markandshare There are several issues with the code you posted, some of which will impact your ability to retry request requiring authorization, especially if you have other requests needing to retry at the same time.

First and foremost, you're recreating your SessionManager every time you make a request. This has both a performance impact, as you're recreating quite a bit of state every time, as well as preventing you from using a common retrier for all requests.Your SessionManager should be a singleton, and the logic that builds your requests and issues them to the SessionManager instance should not be part of a view controller. This will be more performant and allow you to take advantage of Alamofire's retry features.

Second, you're not adding a retrier to the SessionManager when you initialize it, so there is nothing attempting to retry. You need to add the retrier when you create the SessionManager or update to Alamofire 5 and add it when you make the request.

Third, you should not be doing any sort of connection precheck when making requests. You should make the request and let it fail, using the error you receive to take any next steps, or to trigger retry. Alamofire 5's RetryPolicy type can do this sort of retry for you automatically.

markandshare

comment created time in 6 days

startedAlamofire/AlamofireImage

started time in 6 days

issue commentAlamofire/Alamofire

Adapting and Retrying Requests for Basic Authentication System

@NikKovIos, Thanks for your help.

So does that mean the retrier support the mechanism of session ID management, for my case?

markandshare

comment created time in 6 days

issue commentAlamofire/Alamofire

Adapting and Retrying Requests for Basic Authentication System

@SandraMarcelaHerreraArriaga, Thanks for your help.

The site seems to discuss the problem when the authentication system adopted the token approach. However, our app simply authenticates the user by the username and password only with a simple session management (handled by session IDs) without token generation.

markandshare

comment created time in 6 days

issue commentAlamofire/Alamofire

Adapting and Retrying Requests for Basic Authentication System

@cnoon, Thanks for your reply.

Here's the sample code for initialising the session in the SignInViewController:

class SignInViewController: UIViewController, MainPageDelegate, UIScrollViewDelegate, UITextFieldDelegate {
    
    // Session Manager
    var sessionManager = Alamofire.SessionManager()
    var headers: HTTPHeaders = [:]

    var username = ""
    var password = ""
    
    @IBOutlet weak var textFieldUsername: UITextField!
    @IBOutlet weak var textFieldPassword: UITextField!
    @IBOutlet weak var loginButton: UIButton!
    @IBOutlet weak var scrollView: UIScrollView!
    
    // Login function
    @IBAction func buttonLogin(_sender: UIButton) {
        // Authentication API
        let URL_USER_LOGIN = serverConstant.URL_HOME + "/loginProcessRest"

        username = textFieldUsername.text!
        password = textFieldPassword.text!
        
        // API parameters for user authentication
        let parameters: Parameters=["j_username": user,
                                    "j_password": password,
                                    "json": "true"]
        
        
        if let authorizationHeader = Request.authorizationHeader(user: user, password: password){
            headers[authorizationHeader.key] = authorizationHeader.value
        }
                
        if !isConnectedToInternet() {
            /* Some action for no network connection */
        }
        else {
            sessionManager = Alamofire.SessionManager(serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverConstant.serverTrustPolicies))
            sessionManager.request(URL_USER_LOGIN, method: .post, parameters: parameters, headers: headers).responseJSON {
                //making a post request
                loginResponse in
                
                if loginResponse.response?.statusCode == nil {
                    /* Action of Error handling for server error */
                }
                
                if let result = loginResponse.result.value {
                    /* Store user's profile data to local storage */
                }
                
                // Check for user's role privilege
                self.getUserPriviliege(userId: String(self.userId)) { returnUserAuthList, error in
                    
                    if returnUserAuthList!.contains("<UNAUTHORIZED_ROLE_NAME>") {
                        /* Action of Error handling for role authentication error */
                    }
                    else {
                        if loginResponse.result.value != nil {
                            /* Some actions for Keychain services */
                            /* Another actions for getting user's other profile data and store locally */
                        }
                        else {
                            /* Action of Error handling for invalid username and password */
                        }
                    }
                }
            }
        }
    }

    func getSomeUserData(completionHandler: @escaping (SomeDataType?, [SomeDataList]?, Error?) -> Void) {
        let URL_GET_SOMEUSERDATA = serverConstant.BASE_API_URL + "/v1/someUserData"
        /* Some variables declaration */

        self.sessionManager.request(URL_GET_SOMEUSERDATA, method: .get, parameters: nil, headers: self.headers).responseJSON {
            //making a get request
            response in            
            do {
                someDataList = try JSONDecoder().decode(Array<SomeDataList>.self, from: response.data!)
                completionHandler(someData, someDataList, nil)
            } catch {
                print ("[Error] Error in decode JSON - ", error)
                completionHandler(nil, nil, error)
            }
        }
    }
}

The function getSomeUserData is a sample API request handling function for my app to get data from the server via API. These kind of requesting functions will be called when the data is needed to grab down from server.

Recently, I also had another problem of handling another type session expiry. This expiry problem is because the app was not be terminated (still working in background and using other apps) after the user successfully signed in before. I was trying to check this type of inactivity by determining whether the API returns 401 status and ask the user signing in again. May I know whether there is mechanism to achieve this by the library?

Sorry for my late reply and many thanks for your help in advance.

markandshare

comment created time in 6 days

startedAlamofire/Alamofire

started time in 6 days

startedAlamofire/Alamofire

started time in 6 days

startedAlamofire/Alamofire

started time in 6 days

startedAlamofire/Alamofire

started time in 7 days

startedAlamofire/Alamofire

started time in 7 days

startedAlamofire/AlamofireImage

started time in 7 days

startedAlamofire/Alamofire

started time in 7 days

startedAlamofire/Alamofire

started time in 8 days

startedAlamofire/Alamofire

started time in 8 days

startedAlamofire/Alamofire

started time in 8 days

startedAlamofire/Alamofire

started time in 8 days

fork hsnetzer/Alamofire

Elegant HTTP Networking in Swift

fork in 8 days

startedAlamofire/AlamofireImage

started time in 8 days

more