iPad fullNameFromDevice is not retrieved while iPhone fullNameFromDevice is properly retrieved

StackOverflow https://stackoverflow.com/questions/16856452

  •  30-05-2022
  •  | 
  •  

Question

Sample code to get fullNameFromDevice

I have implemented this sample category to get the "fullNameFromDevice" inside my application.Even this example is also not giving me fullNameFromDevice for iPad.There is not any issue to read iPhone device or iPad/iPhone simulator's name using this category.Only issue comes with iPad name.What problem can be? Suggest me the appropriate solution of this issue.

Était-ce utile?

La solution

Your iPad's name doesn't fit naming patterns suggested by this category.

Look at -(NSString *)fullNameFromDevice:

if (![self deviceNameContainDeviceKind])
    return nil;

Then at

-(BOOL)deviceNameContainDeviceKind
{
    return [self.name rangeOfString:@"iPhone"].location != NSNotFound
    || [self.name rangeOfString:@"iPod"].location != NSNotFound
    || [self.name rangeOfString:@"iPad"].location != NSNotFound;
}

You can see that if device's name does not contain "iPhone", "iPod" or "iPad", fullNameFromDevice will return nil.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top