Capturing the Application Delete or uninstall event in iPhone - iphone

I need to be able to delete a user account from a database on a server when a user deletes our iPhone application. What is the best way to capture the delete process. When the user holds down a finger on the application and the big "X" appears. The user presses it and the user is prompted to confirm the deletion of the application. I want to be able to capture the process and clean up the server database of users before the application is actually deleted.
What method is called when you delete an application? Any thoughts?

Apple does not let you do such a thing. It cannot be done.
I suggest you mark an account for inactivity instead, or use some other solution.

Related

When to create PFInstallation

I am new to using PFinstallations on Parse, and i am a bit confused as to how they work. I have an app that creates a new installation when a user creates an account, and i set the "User" field of the installation to the users userId so i can send them notifications easily later. I dont understand how the installation works when the user logs out or closes the app. In order to be able to always send the user a notification, must i create new installations periodically when these events (ie. logging out or closing the app) occur?
You shouldn't ever need to create an instance of PFInstallation. The parse framework will handle that for you if you access it using PFInstallation.currentInstallation(). But to save it to the backend, you'll need to call one of the save methods yourself.
By default, logging out will have no impact on the installation since it is a method on the user. You can have you own logic that modifies the installation on logout to, for example, clear the user field or channels.
The parse framework writes the installation to disk on the users device. When the app stops running and then restarts, parse can just read that data from disk and have the proper PFInstallation object again.

Call status change web-service when my App is deleted

In my application , i works with web-services and when user log in into my app my app is sending a request with status 1 means loged in and when on log out button click sending a request with status 0.
Now problem is , when user removes app from devices , status in my server is remain 1(log in) , hence other user can see him available while his app is not in device. so is there any way by which i can send request when my app removes from device (i don't think it is possible) or is there any other way that i can do in my backend side ?
Thanks in advance.
It is not possible to call a web service when the user deleting the app from an ios device. There are three methods to came to know that whether your application is there in user's ios device. But there are few limitations also.
Activate Push notification: By doing this, device will get registered with Apple's push notification service. When user delete the app from device, the registration will be revoked from APNS server and through the APNS feedback service, you can get to know whether the application is existing. (Limitation: If the user did not agree with receiving push notifications, then the app will not be registered with APNS and you never came to know that whether application is existing or not)
Activate Location Based service: If your application enables location based service, then your application will get periodic location updates in a location delegate method. In this delegate, you can call a webservice and keep update the status of user even the application is in background. (Limitation: If user disables the location update, then your server will not get info about user status)
Periodically Call a Webservice From you app: This is possible only if your app is active. (Limitation: When you application pushed in to background, your application will be in suspended mode, so it will not possible to call webservice)
Sorry Unfortunately Apple not provide any method that user Uninstall app from user's device, There is no such method.
When user delete any application device does give the alert "Do you want to delete this application" with option "Delete" and "Cancel". You don't have to write any specific code for this.
I just assume that There is one method in which you can find out when user is about to delete your app. That is you need to implement push notification Apple server will inform you when you try to push to an uninstalled instance. Other than that there's no way to detect it but i am not sure its helpful or not.
You can't do this from within the app. You would want to do something like have a periodic task which runs on the backend, checking the last activity date of logged in users and setting them to 'not available' after some configured period of inactivity. This will probably require some changes to the backend to record last activity date and a change to the app so that while it's open it sends a periodic 'heartbeat' to the backend. You probably want to make the timeout quite big (say 15 minutes, big enough to not have a large impact on performance).

How to call Web service Continuously in ios

I have an ios app.
In which i have multi user account.So multiple user can Login.
When one user see other user profile and if that user is also online i want to notify him.
I can't get how to implement it.
If i have to continuously check some flag value on server if someone has checked their profile or how can i handle it?
Remote notifications is the way to do it. The logic on when and who has to be notified can be handled at the server.
You may have seen lots of apps asking for permissions to send notification. The downside being if the user denies that permission.
Polling from client side can also be one of the methods which can be used and but would require the client to do most of the computation.
So all in all, its a call you got to take considering what you are building.

how to use the iphone auto renew subscription without a server

So all the documentation and posts I see about auto-renew subscription are using the server side model to deliver products. Is there a particular reason why one couldn't use the Built-in model.
I am creating a audio player app that will provide new original music every month. With service side verification I understand that it checks to see if the receipt is valid before allowing the user to download the audios from my server.
However, couldn't I just program my app to ping the app store to see if their subscription is active. If their subscription isn't active have the app sit on the home screen saying "Please renew your subscription before regaining access to the audio player"
It's my understanding that the server side model is there to prevent pirates from gaining access to my servers resources. Is there any other reason I should use it?
It depends on whether you want your application to be hacked or not.
Main reason for all the validation routine is that once application is available to user, he can modify it in any way he likes which can be seen on all the hacked iPhone apps out there.
So in your case they would delete all checks from your code and set "active" to true.

How to Lock and Unlock contents on In-App-Purchasing?

I am just trying to implement In-App-Purchasing with in my application and I am successfully able to test my application but I want to offer few part of application will be free and some part will be give to user after payment. How can I do it. Thank you.
we basically keep the features locked in our application and unlock them after user makes in app purchase. To lure the user, when user tries to access that feature, we usually show the user message that it is locked in this version of application and in order to unlock it, in app purchase needs to be done.
All the features should have unique product identifier, so as to identify which feature the user unlocked (purchased)