Thursday, March 21, 2024
HomeiOS Developmentc# - iOS 17 URL encoding trigger challenge in Xamarin.Varieties

c# – iOS 17 URL encoding trigger challenge in Xamarin.Varieties


I’ve a xamarin.kinds app which have a GET Api URL like this

sampleurl.com/my-app-data/requests?orderBy=-created_at&associated=consumer,+function&perPage=100

This have been working tremendous on Andorid and iOS 16.However after iOS 17, The "?" getting modified to "%" within the URL like this.

sampleurl.com/my-app-data/requestspercentorderBy=-created_at&associated=consumer,+function&perPage=100

which inflicting error. I guessing that after iOS 17 apple launched a url parsing behaviour which inflicting this.How we will deal with this challenge?

My code resposible for dealing with API name is following

  var shopper = new HttpClient { BaseAddress = baseAddress };
                shopper.DefaultRequestHeaders.Settle for.Add(new MediaTypeWithQualityHeaderValue("utility/json"));
                var present = Connectivity.NetworkAccess;

                    if (receivedMethod == APIMethodConstants.GET)
                    {
                        req = new HttpRequestMessage(HttpMethod.Get, apiurl);
                        shopper.DefaultRequestHeaders.Authorization =
                        new AuthenticationHeaderValue("bearer", JwtToken);
                        Activity<string> activity = Activity.Run(async () => await Threading(shopper, req));
                        activity.Wait();
                        stringObtained = activity.End result;
                        jsonObtained = stringObtained;
                    }

        async Activity<string> Threading(HttpClient shopper, HttpRequestMessage req)
        {
            WebUtility.UrlDecode(req.RequestUri.ToString());
            var resp = await shopper.SendAsync(req);
            swap (resp.StatusCode)
            {
                  //relaxation logic
            }
            return stringObtained;
        }

Any assistance is appriciated.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments