question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[expo-device] iPhone 12 is not recognized as modelName

See original GitHub issue

🐛 Bug Report

Summary of Issue

iPhone 12 is not recognized as model Name, device model for iPhone 12 is just iPhone

Environment - output of expo diagnostics & the platform(s) you’re targeting

"expo": "^39.0.4",
"expo-cli": "^3.18.0",
"expo-device": "^2.3.0",

Reproducible Demo

import * as Device from “expo-device”; import * as Notifications from “expo-notifications”; import axios from “axios”; import { DeviceTokenExist } from “…/constants/apiConstants”; import { saveDevice } from “…/api/notificationsApi”; import Constants from “expo-constants”; import { Alert } from “react-native”; import { UserDeviceStatus } from “…/utils/enums/UserDeviceStatus”;

export const useRegisterDevice = async (dispatch) => { let token = (await Notifications.getExpoPushTokenAsync()).data; var result = null; try { result = await axios.get( ${Constants.manifest.extra.apiurl}/${DeviceTokenExist}?deviceid=${token}&brand=${Device.brand}&model=${Device.modelName} ); } catch (error) { console.log(“device id: error”, error); }

if (result) { if (result.data === UserDeviceStatus.NoToken) { Alert.alert( “Notificaties toestaan”, “Mogen wij jou op deze telefoon notificaties toesturen?”, [ { text: “Ja”, onPress: () => { saveDevice(dispatch, { deviceID: token, deviceBrand: Device.brand, deviceModel: Device.modelName, }); }, }, { text: “Liever niet”, onPress: () => {} }, ], { cancelable: false } ); } if (result.data === UserDeviceStatus.InvalidToken) { renewRegisterDevice(dispatch); } } };

Steps to Reproduce

import * as Device from “expo-device”;

Just use Device.modelName for iPhone 12 and you will get iPhone for modelName instead of iPhone 12 or similar

Expected Behavior vs Actual Behavior

Expected behavior is to get iPhone 12 recognized as a model, not generic 'iPhone"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
AdamJNavarrocommented, Nov 17, 2020

Hey @milennaj, thanks for bringing this to our attention. It looks like we haven’t updated the model names list to accommodate the iPhone 12 models yet. We’ll try and update this as soon as possible.

For reference, these are the values to be expected for the iPhone 12 line:

“iPhone13,1”: “iPhone 12 mini”, “iPhone13,2”: “iPhone 12”, “iPhone13,3”: “iPhone 12 Pro”, “iPhone13,4”: “iPhone 12 Pro Max”,

Cheers, Adam

1reaction
karlazzamcommented, Mar 16, 2021

@AdamJNavarro device list still hasn’t been updated with the iphone 12 line

Read more comments on GitHub >

github_iconTop Results From Across the Web

If your computer doesn't recognize your iPhone or iPad
If your computer doesn't recognize your iPhone or iPad ¡ Look in the Finder or iTunes ¡ Update the software on all devices...
Read more >
Device - Expo Documentation
expo-device provides access to system information about the physical device, such as its manufacturer and model. Platform Compatibility. Android Device, Android ...
Read more >
How to determine the current iPhone/device model?
unrecognized (let string) let modelName: String = UIDevice.model.name // iPhone 6, iPhone X, etc... This is the code inside the gist public extension...
Read more >
How to find your iPhone model name and number
That's not a problem, though, because you can quickly find out your model name and model number in your iPhone's Settings app.
Read more >
Connect iPhone to PC - CopyTrans
Windows computers require iOS drivers to correctly recognize iPhone, iPad, and iPod touch devices. If your iPhone is still not detected, chances ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found