Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1269] Update generation of the OS version part of the user agent to use non-localized sources. #1292

Merged
merged 2 commits into from
Jun 12, 2016

Conversation

jshier
Copy link
Contributor

@jshier jshier commented Jun 5, 2016

Fixes #1269. Updates the user agent’s OS version to use non-localized sources. It also includes the actual OS name in the string.

@cnoon
Copy link
Member

cnoon commented Jun 12, 2016

Okay so I've spent some time making sure that we get this exactly right. Here's a few examples of what we get if we don't change anything.

English

  • Process Info: Version 9.3 (Build 13E230)
  • User Agent: appname/bundle_id (1606122225; OS Version 9.3 (Build 13E230))

Japanese

  • Process Info: バージョン 9.3(ビルド 13E230)
  • User Agent: appname/bundle_id (1606122229; OS bajon 9.3(birudo 13E230))

Spanish

  • Process Info: Versión 9.3 (Fase 13E230)
  • User Agent: appname/bundle_id (1606122227; OS Version 9.3 (Fase 13E230))

Russian

  • Process Info: Версия 9.3 (Выпуск 13E230)
  • User Agent: appname/bundle_id (1606122226; OS Versia 9.3 (Vypusk 13E230))

Thai

  • Process Info: เวอร์ชั่น 9.3 (บิลด์ 13E230)
  • User Agent: appname/bundle_id (1606122228; OS wexrchan 9.3 (bi ld 13E230))

Therefore, we definitely need to make this change!

Now what's interesting is that we no longer need to run the CFStringTransform. It's not possible to have a non-latin character come through as the app name or the bundle id. I spent some time trying this out, and Apple replaces any non-latin characters in the app name or bundle id with nothing or a -. Therefore, we no longer need to run the CFStringTransform on this string to be safe. I'll update the PR based on this info.

@cnoon cnoon force-pushed the fix/1269-non-localized-user-agent branch from 603a7fa to 3591bfa Compare June 12, 2016 22:55
@cnoon
Copy link
Member

cnoon commented Jun 12, 2016

Removed the CFStringTransform logic in 3591bfa and then rebased.

@cnoon cnoon self-assigned this Jun 12, 2016
@cnoon cnoon added this to the 3.5.0 milestone Jun 12, 2016
@cnoon cnoon merged commit cceee03 into master Jun 12, 2016
@cnoon cnoon deleted the fix/1269-non-localized-user-agent branch June 12, 2016 22:56
@cnoon cnoon modified the milestones: 3.4.1, 3.5.0 Jun 13, 2016
if CFStringTransform(mutableUserAgent, UnsafeMutablePointer<CFRange>(nil), transform, false) {
return mutableUserAgent as String
}
let osNameVersion: String = {
Copy link

@onmyway133 onmyway133 Jun 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jshier thanks, but we miss the OS build version (like Build 13E230), right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the build number is no longer going to be present because we cannot extract it in a non-localized manner.

@bgerstle
Copy link

@cnoon I would love to know how you tested this. I mentioned that I tried a few things, but couldn't get the operatingSystemVersionString value to change. Thanks for providing a fix we can all benefit from!

@cnoon
Copy link
Member

cnoon commented Jun 17, 2016

Hi @bgerstle,

One of the apps I work on is localized in 20 languages. All I did was drop some log messages into our AppDelegate printing out the operatingSystemVersionString values and ran it in the different languages posted above as an experiment.

You can easily add additional localizations to a sample project by adding a new localization in your project's Info settings. Here's a link to get you started if you haven't done this before. Then you can switch between locales when launching by switching Scheme's runtime language which can be done by Edit Scheme -> Run -> Options -> Application Language.

Cheers. 🍻

@bgerstle
Copy link

Thanks! But the strange thing is, we've had reports of this happening in
languages our app isn't localized in 😖. Anyway, thanks again for providing
more info!
On Fri, Jun 17, 2016 at 7:31 AM Christian Noon notifications@github.com
wrote:

Hi @bgerstle https://github.com/bgerstle,

One of the apps I work on is localized in 20 languages. All I did was drop
some log messages into our AppDelegate printing out the
operatingSystemVersionString values and ran it in the different languages
posted above as an experiment.

You can easily add additional localizations to a sample project by adding
a new localization in your project's Info settings. Here's a link
http://www.appcoda.com/localization-tutorial-ios8/ to get you started
if you haven't done this before. Then you can switch between locales when
launching by switching Scheme's runtime language which can be done by Edit
Scheme -> Run -> Options -> Application Language.

Cheers. 🍻


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1292 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAbHOTHWyBvox391AH3niBFc3B7zQjaeks5qMq-3gaJpZM4IuS5b
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants