iPhone Data Usage Monitoring [duplicate] - iphone

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
iPhone Data Usage Tracking/Monitoring
I'm trying to build a "Data Usage Monitoring" iphone app as a quick demo, but haven't been able to figure out how to get CellularData/Wifi usage statistics programmatically.
I know this is possible, as there are several apps in the app store for this (DataUsage, DataMan).
I know for a fact that these are not scrapping the cellular provider's pages to get the data usage, so I'm wondering how they are able to achieve this.
Couldn't find anything in the iOS 4.2 SDK Documentation.
I'm guessing they are somehow getting the data that is displayed under "Settings -> General -> Usage",

Hey, this is sort of untested - I tried it on the simulator, but it obviously doesn't store any data usage statistics. Try to give this code a shot on an iPhone device.
NSLog(#"Contents of the user defaults: %#", [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);
It should print out the entire contents of the users preferences. You should then be able to dig out the appropriate keys for accessing the data you need.
Tell me whether it works or not :D

Related

NSUserDefaults Inconsistency or device inconsistency? - iPhone

I have developed a server based app for iPhone. But according to client requirements and to avoid overloading on server side, i am required to store data on local end. It is all text and typically 2-4 MB in size.
For this i'm using NSUserDefaults instead of sqlite or CoreData.
The app has been tested successfully for around 2-3 months during it's development as well as post development testing and never shown any type of inconsistency in data storage, updation or deletion on any sort of iphone device from iphone 3G - iphone 4S.
Now there is an incosistency issue in the live app, when user leave the app idle on a screen for around 15-20 minutes and doesn't press home button means app is not in the background.
In this case, data seems to be lost.
But as soon as refresh app, in that case data appears again & app starts functioning normal again.
Here lies the main problem that when i'm refreshing, i'm doing nothing but only fetching fresh data from the server it can be simply one to five records or nothing at all.
Then app is refreshed, all of the records are shown & it functions normally.
I have been trying to spot the issue for around 3 days, and it's not happening on my device (iPhone 4S). As far as i can think, it seems to be problem with the old devices.
Previously in testing, none of this happened on old or new devices.
My questions are -
a) Is this an incosistency in my coding?
b) Are NSUserDefaults not trustworthy for database management for live apps?
c) Is it a device version specific problem related to NSUserDefaults?
Anybody faced/facing the problem with NSUserDefaults??
Please suggest me something i can do for this or tell me i have to do all the database work again for the next version using sqlite or CoreData.
Anyhow this is critically important and needs to be fixed.
Any help is appreciated in advance.
As my suggestion for you please introduce the Sqlite database integration because of the when the short size of the data store and of cause it's good rather then the Sqlite but it's not working into large number of the data that time must use the Sqlite or coredata.
so i suggest to use the Sqlite data and coredata.

How can you get your historic location data from new iPhones with iOS 5 (for personal use)?

It used to be easy to get your historic location data from a file called consolidated.db on an iPhone (see, for example, http://petewarden.github.com/iPhoneTracker/). However, this is more difficult on new iOS systems. Is your data still somewhere on your phone, though, and is it possible to access it?
To be clear, I'm not looking to use the location API; rather, I'd like my historic location data as an end-user of my device. Are there any scripts/apps available that can do this for me?
This doesn't really answer my own question (I'm still interested in iPhone historical location data, so please answer if you have any ideas!), but there are apps that will allow you to store your location data:
OpenPaths, http://openpaths.cc/, which seems to provide the most control and a good policy about how they handle your data (I've not used it before, but if anyone has any insights, they're certainly welcome.
Google Latitude, http://www.google.com/latitude, which allows you to export 30 days of location data in KML format.
Both of these exist for both iOS and Android.

App Approval by Apple [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Does apple view the actual source code when approving apps?
So I'm gearing up for my first submission to the App Store, but before I submit I have a quick question or two.
1) First off - when submitting, will Apple be looking through code and verifying its correctness or just testing the App itself?
2) If Apple is indeed looking closely at the code, does whether or not you follow Apple's suggested paradigms influence whether or not the App is accepted? For example; In my program I frequently use [self dismissViewControllerAnimated::] rather than the Apple specified way of using delegation to have the presenting VC dismiss its presented VC's.
Just like to get feedback from people who maybe have already gone through the process and could give feedback on the experience. Thanks for your time!
Apple will not look at your code. All you submit is your binary application.
You are not going to submit the source code so be patient, none will stole your cool patterns :)
However, there's usually a good reason to recommend one or another approach, you'd better to think about following Apple recommendation not to appear among a lot of deprecated, slow or even disabled functionality.
Another point is that while they are not looking through your code directly, they are still kinda able to catch the used methods symbols which allows them to detect the private API usage and sometimes the app gets rejected just for your method being the match to the private API method from a signature, that's not happen often, but you better be accurate.
Another free recommendation for you - store the .dsym file somewhere, it will help you to symbolicate the crashes which could appear later right from the report file (you'll also need the app binary for that).

Looking to create an iphone app with a database to save photos taken

looking to make an iOS app where I can take a picture and then send it to a my own searchable database, website or wiki. What would be the easiest service to do this (I can do the iOS programming its just I don't know about the other side of it).
The easiest option would be to use CoreData. If you don't know about CoreData, Apple has a very comprehensive set of documentation located here: https://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html
Using CD, you can save the images as NSData in the persistent store, and then turn them back into images as you fetch them from the store. The most common implementation of CoreData uses SQLite as the backing store.
I am not quite sure how to answer your question without building a db for you. If you are just looking for resources on how to build a db, check out this stackoverflow question

How does iOS store persistent data with encryption?

Can an iPhone app encrypt its stored data? So that even a user with a Jailbroken iOS device cannot access the file. For example, game-center may sync with local data, you do not want the user manipulating the scores. You do not want your IAP be circumvented either.
Is there a simple way to encrypt your data before writing to the device?
Maybe my questions are not very clear. Indeed they are:
When I'm using things like: [array writeToFile:path atomically:YES]; is there any auto-encryption that ensures only my app can access the file correctly?
If not, what is the simplest way to achieve it?
PS: now I found NSData can do the job, but the NSDataWritingFileProtectionComplete flag requires #if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED. I wonder what happens on not-supported devices?
More information on iOS encryption in #GrahamLee's answer to this question and on other iOS tagged questions on security.stackexchange.com.
Basic summary is - based on iPhone controls alone:
If someone has the device and it isn't locked, they can access all the data
If someone has the device and it is locked, they can get most of the data, and possibly all (some exceptions may apply)
You could obfuscate, and use encryption within your app when storing data, but an attacker could reverse engineer that encryption code to decrypt.
You need to work out the value of such DRM techniques and decide whether they are worthwhile in this scenario.
That docs will help you to find more accurate answer:
http://sit.sit.fraunhofer.de/studies/en/sc-iphone-passwords.pdf
http://sit.sit.fraunhofer.de/studies/en/sc-iphone-passwords-faq.pdf