Store settings ios5 - ios

My iOS app has a need to uniquely identify each device so it can retrieve files that it has uploaded to the server with as little user interaction as possible (IE we don't want the user to have to have a username and password). With the release of iOS5, apple has deprecated the UDIDs which would have been the easiest way to go about this. The other way would be to generate and store an identifier on the device and read it from there every time. However, apple could at any time delete the files because they feel there isn't enough free space on the device.
Is there a way to store a device identifier on the local filesystem without worrying about apple "cleaning" it for me?
Or if there's not, how would I go about generating a device identifier that would be the same for one device no matter how many times I generated it but still different from all other identifiers?

You can use the Wireless NIC's MAC Address as the unique identifier.
Also, any files in the Documents directory will not be wiped by apple and will be sync'ed via iCloud. Apple says all generated content should NOT go in the Documents directory (at least if it can be regenerated).
To get the MAC Address I used code from this post: How can I programmatically get the MAC address of an iphone.

Related

Programmatically erase iPhone's data swift

I am developing an iPhone Application to wipe all data from iPhone including photos, videos, contacts, messages, apps, etc. programmatically. I wish to achieve this with an iPhone Application only.
The approach I am thinking of somehow I manage to Clear data from iPhone and rewrite the memory with some junk files or binary data 1010 say. (Its just an idea!)
All I have managed to do is delete photos from Photos which are further not deleted from Recently deleted folder in Photos App.
Also, I found this Programmatically How to wipe out iPhone or iPad data in i phone apps in i phone apps which declines it's feasibilty.
But, Is there a way to programatically restore my iphone to factory settings? says using the C files mentioned here https://github.com/lite/osxrce/blob/master/resetapp/main.m can may be make it possible. They say they tried it on a jailbroken device though.
What you are hoping to do isn't possible on an non-jailbroken iPhone. You will be violating the iOS sandboxing among other things.
A similar outcome may be possible by creating your own MDM server, and building your app to interface with it. On first installation of your app, you can have it install the MDM profile. The app can then feature your 'Wipe' button which can signal to the MDM to send a wipe push notification to the device.
It would take a lot more work that what you're asking about, but it should be possible.
Reference: https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf
Apple do not allow to delete files which aren't created or part of your application, so you will not be able to delete data of other apps.
I don't think you're allowed to do that anyway. Even if you were able to do it, it would not be accepted on the app store.
You can backup the iPhone via AppleMobileBackup.exe -b, then modify the according
database file(such as addresscontacts, messages), and restore the modified ituensbackup files to the iPhone via AppleMobileBackup.exe -r.

How can i export app file in Xcode

Do you know how to export app file in Xcode?
(like .apk file in android)
I want to send my testing app to someone for feedback.
i have never tried it before. please let me know easy way to export app file.
(not all project, only a file which can be played in another iPhone)
First Archive it (XCode->Product->Archive).
(For Archive button to be in visible state : either your device should be selected or generic ios device should be selected, incase any simulator is selected archive button will be disabled.)
A Window will appear :
Choose Export->AdHoc.
.ipa will be generated.
u can use https://www.diawi.com/ for uploading and send app to anyone.
I am posting a very late response to this old question in case anyone else finds their way here and infers that it isn't possible to export an app to your own iPhone or iPad without a developer account. That isn't true. I unearthed these posts when looking for an answer to the same question, and initially read them that way.
If you want to test an app you have written in XCode on your own iOS device you do not need a developer account. Provided the device you wish to test it on (or share it with) is physically nearby so that you can connect it to your macOS device to pair with it as a trusted device, it will remain paired when physically disconnected and accessible over a shared network by WiFi. You can build and run apps from XCode on to the iOS destination device and they will remain in place there and executable afterwards. There is a limit to how many exported apps there can be at one time, which seems to be 3.
Apple explain how to do all this here. You do need to have a registered App Store account, but that's the same one you use to buy apps and build projects in XCode, and it's free unless you want to distribute your app through the App Store.

How can I tell if my user upgraded to a new phone, or restored from a backup in iOS?

I want to make getting a new device as easy as possible in my iOS app.
However, I want to ensure that the old instance of the app (and more importantly the data) is no longer accessible on the old phone.
How can I track the uniqueness of a phone, and if the app has been installed on more than one device?
My goal isn't to control licensing, but rather to make sure the user knows what is "out there".
(My app stores private keys in the app container, and I want to ensure these keys don't fall into the wrong hands... hence the reason for my question)
UIDevice offers identifierForVendor
The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.

iOS 8 Unique Identifier (Serial Number preferred)

I am working on an enterprise app and need access to programmatically retrieve the device's serial number. Is there an API or any documentation on how to retrieve this in iOS 8? From what I can tell, this functionality has been removed in iOS 8.
Is there a suitable replacement identifier for the serial? I need something that is reliable and will never change even if the device is reset.
It will be for enterprise usage so App Store approval is not a concern.
You're up a creek here. The two "tracking" features are Advertising Identifier and Identifier for Vendor. The former can be reset within the Settings app quite easily while the latter will reset once the user uninstalls all apps with the root bundle identifier associated with the app suite. Both also change with a device reset of course.
If you're deploying the app with an MDM solution you will have access to that device's UDID as it still flows forward to MDM servers, you just can't access it programmatically in your code. The complete deprecation of UDID, serial number and MAC address (even with private APIs) stomped all over some custom utilities I wrote within our Enterprise to try and accomplish something similar to what you're looking to do. If you find somethingthats consistent I'd love to see the follow-up!
EDIT:
I had an epiphany while circling back to this situation again. If you are in fact using AirWatch (I can't speak to Mobile Iron, etc) you can setup the console to send a keychain value to each device at the time of app install. From there the app will be able to consume the value AirWatch sends down. The same goes for any attribute that AirWatch harvests for the device (serial, UDID, MAC, etc). While this workaround comes with a big caveat (using AirWatch for deployment) it will work. Since Apple neutered all Serial Number work arounds win iOS8 this is the most viable option I have found.

Why same iCloud account but got different ubiquityIdentityToken

i am trying to implement an App with iCloud Key-value storage feature.
Currently, I'm testing it from two devices iPhone5s with iOS7.0.4 and iPhone4 with iOS6.1.1.
Do you guys have any idea why the same iCloud account (checked from Settings -> iCloud -> Account) gets two different ubiquityIdentityToken? i guess this is the reason the data didn't sync between this two devices (network accessed).
And on iOS6, NSUbiquitousKeyValueStoreDidChangeExternallyNotification is not trigging.
Thanks in advance!
The ubiquityIdentityToken is only intended to be used to:
Determine if iCloud is available to your app
Determine if the iCloud account has changed (by comparing to a previously saved value).
It's opaque but conforms to a few protocols. You can save it locally and compare the current value with a previous value, but that's about all it's good for. It's not guaranteed to be useful in any other situation.
It's not guaranteed to be the same on different devices, even if those devices use the same iCloud account. Why it might be different is not documented-- it might encode a device-specific value somehow. Regardless, it's not something that you can transfer from one device to another and expect to still be useful. That's not how it's designed to work.
It does encode a device-specific value in the token. The 8-digit hexadecimal number groups between positions 17 and 22 change on a different device OR with a different iCloud account.
The rest of the groups usually remain the same, across different apps, devices, OR iCloud accounts.
This is strange behaviour. In these cases Apple usually recommends signing out and logging again (using the same Apple ID) on both devices. Try that and see if it helps. Also, make sure to install the latest version of your app (with enabled iCloud) on every device.

Resources