You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2022/07/08 12:03:49 UTC
[GitHub] [cordova-plugin-device] breautek commented on a diff in pull request #168: (iOS) Add support for device name on iOS
breautek commented on code in PR #168:
URL: https://github.com/apache/cordova-plugin-device/pull/168#discussion_r916751443
##########
src/ios/CDVDevice.m:
##########
@@ -86,10 +86,14 @@ - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
- (NSDictionary*)deviceProperties
{
UIDevice* device = [UIDevice currentDevice];
+ //strip non-alphanumeric from device name
+ NSCharacterSet *charactersToRemove = [[NSCharacterSet alphanumericCharacterSet] invertedSet];
+ NSString *deviceName = [[[device name] componentsSeparatedByCharactersInSet:charactersToRemove] componentsJoinedByString:@""];
Review Comment:
Apple's documentation for [UIDevice->name](https://developer.apple.com/documentation/uikit/uidevice/1620015-name?language=objc) states
> The value of this property is an arbitrary alphanumeric string that is associated with the device as an identifier. For example, you can find the name of an iOS device in the General > About settings.
So is scanning for non-alphanumeric characters really necessarily? Apple specifically states it's an alphanumeric string.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org