4 ms·
I agree wholeheartedly that it’s garbage. I don’t want to watch videos, I want comprehensive, detailed API documentation. Here’s one obvious example that comes
by umanwizard 7y ago
I agree wholeheartedly that it’s garbage. I don’t want to watch videos, I want comprehensive, detailed API documentation.
Here’s one obvious example that comes to mind: how do I turn on the GPS on iOS? This is documented nowhere. The answer is that location requested with an accuracy above 100 meters will use cell towers, below 100 will use WiFi geolocation, and below some other threshold (10 meters? I forget) will use GPS. But that’s nowhere in the docs. They just tell you “use what you need”.
Here’s another one, what is the maximum size of a process’s address space on an iPhone? This one is not documented anywhere, you actually have to read the kernel source code to figure it out!
These are just two examples that popped into my head from ~3 years of iOS work. But they’re the rule, not the exception. Apple documentation tells you how to do basic and standard things the way Apple expects. It doesn’t give actual details of how things work.
- drfuchs 7y agoI'll bite: What is the maximum size of a process’s address space on an iPhone?
- umanwizard 7y agoIt depends on the device. I think low double digit GB for the current big ones (maybe 10-15 GB). Don’t remember the details though.
- w0utert 7y agoIf these are the 'best worst examples' you can come up with after ~3 years of iOS work, they are not really convincing. I just scanned the CoreLocation docs, and while it is true they do not explicitly state what sources are used for getting a certain accuracy, the documentation makes it very clear and unambiguous what you should use. You use kCLLocationAccuracyBest if you need to be absolutely sure you have the highest accuracy, otherwise you use one of the distance-based accuracy settings. How these get the location should be irrelevant to any application that doesn't need to force 'best available', and it's pretty clear from how the API is structured that iOS will combine whatever data is available to give you the accuracy you asked for (ie: if there is no cell tower or WIFI geolocation available, it will fall back to GPS even for the lower-accuracy setting). It took me only 5 minutes of reading the documentation to figure this out, I would say its an example of good documentation, not bad documentation. As for 'how large is the maximum iPhone process address space', I don't really know how bad it is that you cannot easily find this documented. It doesn't really seem like something many apps need to know about, and highly specific to the iOS version and maybe even hardware it is running on. Not saying your app or whatever you are making doesn't need it, but I estimate this kind of information is irrelevant for close to 99% of apps. I don't think the iOS programming model is such that you can derive any kind of guarantees how much you can allocate from that number. What do you want to use it for?
- umanwizard 7y agoYour assertion in the first paragraph is not actually true. Go to Central Park or somewhere else with no nearby WiFi beacons and try it out. Your test app will not fall back to GPS accuracy. I have done this. So actually the documentation you’re quoting is wrong. As for what you might want to know the maximum address space size for: evaluating whether unattributable production crashes might be due to running out of address space.
- w0utert 7y ago>> Your assertion in the first paragraph is not actually true. Go to Central Park or somewhere else with no nearby WiFi beacons and try it out. Your test app will not fall back to GPS accuracy. I have done this That's not what I said, nor what the documentation said. From the documentation: The system always tries to give you the best location data that is available, but these properties give the system the flexibility to turn off hardware elements when they are not needed. For example, if you set the desired accuracy to kCLLocationAccuracyKilometer, the system might disable GPS and use only the Wi-Fi hardware, which would save power and still give you a greater accuracy than you requested. In other words: the system will not promote the returned accuracy if the data it has is already within the accuracy you asked for, but it will still fall back to whatever source of location data available, possibly higher accuracy, if no lower-accuracy source is available. This makes a lot of sense, because it is much more common to only have a GPS signal, and no cell tower or WiFi geolocation (e.g. when doing outdoor activities) than the other way around. In that case your '1 km accuracy' app might in fact get you GPS accuracy. But if you are in Central Park, you will most definitely get location data from cell towers, so in that case your app will not promote the accuracy since you didn't ask for it. Ergo, if you need the highest accuracy, you have to ask for it. The documentation makes it very clear the accuracy parameter is not a tool to force a specific accuracy, but to allow the system to relax accuracy in favor of lower power consumption, if your app doesn't need it. Not trying to be snarky here, but in this particular case it seems the problem is not in the documentation, but in your reading comprehension of it. Unless of course there is a bug in CoreLocation, or you got so unlucky when you tested in Central Park, that there was somehow not even a GPS signal available.
- sjwright 7y ago> They just tell you “use what you need”. Huh? How is that not exactly the right answer? You tell the API how accurate you need it to be, iOS will get you that accuracy with the minimum energy consumption necessary. It makes sense to not document the thresholds because they probably aren’t constants. (Or even if they are, they might not be in iOS 14.) It’s entirely possible that the accuracy of non-GPS methods may improve over time. And they would certainly vary greatly depending on the environment. Who knows, if you’re in a concrete jungle with very dense wifi coverage, it could even be more accurate than GPS. Conversely if you’re in a tiny rural town with one cell tower and no wifi, it might have to turn on GPS even if you only need 50 meter accuracy.