Comments (5)
Hi,
Can you capture the response and perhaps provide a sample project? We are unable to reproduce this error locally.
Thanks
Sam
from googleads-consent-sdk-ios.
Tested with SDK version 1.0.1, issue is still the same.
Here is sample project, that can show issue: https://github.com/accidbright/PACConsentSample
Here are the response headers:
<NSHTTPURLResponse: 0x1c8032980> { URL: https://adservice.google.com/getconfig/pubvendors?es=2&plat=ios&v=1.0.1&pubs=pub-0123456789012345 } { Status Code: 200, Headers {
"Access-Control-Allow-Origin" = (
"*"
);
"Cache-Control" = (
private
);
"Content-Disposition" = (
"attachment; filename=\"f.txt\""
);
"Content-Encoding" = (
gzip
);
"Content-Length" = (
5545
);
"Content-Type" = (
"application/json; charset=windows-1251"
);
Date = (
"Fri, 25 May 2018 09:01:27 GMT"
);
Server = (
cafe
);
"alt-svc" = (
"hq=\"googleads.g.doubleclick.net:443\"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=\"googleads.g.doubleclick.net:443\"; ma=2592000; v=\"43,42,41,39,35\",hq=\":443\"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=\":443\"; ma=2592000; v=\"43,42,41,39,35\""
);
p3p = (
"policyref=\"https://www.googleadservices.com/pagead/p3p.xml\", CP=\"NOI DEV PSA PSD IVA IVD OTP OUR OTR IND OTC\""
);
"timing-allow-origin" = (
"*"
);
"x-content-type-options" = (
nosniff
);
"x-xss-protection" = (
"1; mode=block"
);
} }
from googleads-consent-sdk-ios.
Already found the issue by myself. There is encoding problem. According to official Apple docs the method JSONObjectWithData:options:error:
expects UTF encoding:
The data must be in one of the 5 supported encodings listed in the JSON specification: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE.
But data in response is encoded with CP1251. That is not supported by this method.
As the solution I can offer next code:
NSString * dataString = [[NSString alloc] initWithData:data encoding:NSWindowsCP1251StringEncoding];
NSData * dataInUTFEncoding = [dataString dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary<NSString *, id> *info = [NSJSONSerialization JSONObjectWithData:dataInUTFEncoding options:0 error:&error];
instead of existing:
// From file PACPersonalizedAdConsent.m:328
NSDictionary<NSString *, id> *info = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
This code works for me.
from googleads-consent-sdk-ios.
I can reproduce this error using real device but not in simulator
from googleads-consent-sdk-ios.
has this issue been fixed ? why does it fail only on 10.3.3 and 11.3 ? if apple only supports "UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE" then how is it even working at all with CP1251 on non 10.1 and 11.3 devices & how come mine says charset=ISO-8859-1 and not windows1251? @hei9gag @accidbright
from googleads-consent-sdk-ios.
Related Issues (20)
- Xcode 10.1 and pod sport
- Response error. Publisher identifiers not found "ca-app-" Appended HOT 2
- Consent timestamp
- Consent SDK Version 1.3 BUG! HOT 3
- Changing .html file does not update the text on consent form
- requires_arc in podspec set to true
- EU Consent Form iOS Setup Help
- UIWebView, deprecated API used HOT 4
- Change in behaviour. Urgent. HOT 3
- Setting .DEBUG_GEOGRAPHY_EEA causes requestConsentInfoUpdate to fail
- Version 1.0.5 not available in cocoapods HOT 2
- Pinch zoom in and out is working over consent view in version 1.0.5
- Broken support for iOS 9 (at least)
- Plans for this SDK HOT 1
- Consider adding a .gitignore file
- Does the new UMP sdk replace this sdk?
- Sdk ios
- Sdk
- > Add and create ad units. Banner on top? Or something else?
- Default branch is now `main`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from googleads-consent-sdk-ios.