Destroying iOS application programmatically on failed login attempts - ios

My client has come up with a strange requirement. He wants the iOS application to be deleted from the iPad/iPhone on 5 unsuccessful login attempts. I want to tell him that, its just NOT possible. Does anyone know any way of programmatically write a piece of code to self destruct an iOS app ?

At least on non-jailbroken devices this won't be possible. I mean, you can't even close an app without the user explicitly pressing the Home button. Also, the user could just re-download the app, rendering self-destruction moot.
You could - as is common in the Internet - just ban the client's IP or UDID for a while. Or store the number of login attempts on the device and refuse to let the user log in after too many attempts.

You can lock the user out of the application, and delete all of the cached data. But no, you can't erase it.
I suppose you could call abort() on every launch after 5 failed attempts, but I'm not sure you'll get through review if that happens.

Related

Force removal/invalidation of iOS app from user devices

Assuming you created an app that users have downloaded that is just awful and you neither want to fix it nor have anyone continue to use it so that it won't tarnish your brand, is there a way to end its life on user's iOS devices?
Curious if there is some store setting to force it to work with earlier versions of iOS and invalidates the current app, or code that would force an update that says the app is no longer available.
As many have confirmed, there is no way to remove an application from someone's device. For these cases though, many companies have servers that the application sends a request to on launch, that returns either a need to update the app, a message, or to tell the user the app has been discontinued and that the app cannot be used anymore, stopping them from using the app from there on.
The last use case might be useful to you, but of course this is a proactive solution, not a reactive one.

iOS Terminated due to signal 9 on allowing permission [duplicate]

This question already has answers here:
Toggling Privacy settings will kill the app
(2 answers)
Closed 4 years ago.
I am making an iOS app and I am new in iOS world. In this app, I want to access user contacts. Everything is going good and working well. But I experienced a amazing behavior which I have not seen in Android since I am android developer.
In iOS to access user contacts I am using Contacts Framework. I think it is relatively more easy and fast then anyother else in the iOS. However, I did not able to completely take advantage of that. Let me tell you what I did and what Problem did I faced.
What I have done I cask for permission on ViewController and User is prompt with Dialog asking for contacts permission. If user allow permission, everything goes well, but when user dont allow the permission here comes the trouble.
Accessing User contacts are more necessary since My app's whole working and basic business idea is upon user contacts. Now to handle this, when user Do not allow permission I am showing another dialog telling him that He must allow permission so that App can continue, So far so good.
Now I am taking user to settings where he can allow the permission or he can simply go again back. Now checkout 2 cases
CASE 1: When User come on Settings screen and go back again without
allowing permission
When I take user to Settings screen and instead of allowing permission he gets back to my app I try to show him same dialog again to enable permission in every case. This is going good. I mean for testing purpose I repeat same procedure manytimes, I mean I do not allow my self Contacts permission, It takes me to setting scree, from settings screen I get back to my app and again I am able to see same dialog that took me to settings scree. THIS IS FINE
CASE 2: When User is taken to settings screen and he permits the
permission:
Here when user allows the permission I get message in the log that is "Message from debugger: Terminated due to signal 9". And when I get back to my app, it starts over again. Looks like my app gets re-open or crashed being in background.
Important: For this I examined my memory or task anything that is being performed in background, but there is nothing going on in background. My memory size before crashing is 54.78 mb. And I do not think so it is worth worying.
Any one have idea what is going on??
Your app is not crashing its just forced to restart by iOS with new privacy settings. iOS will SIGKILL the app. (it's default behaviour of iOS). You can checkout - WWDC 2012 Session Videos: Privacy Support in iOS and OS X for more info on this.
This does not hold true for Location permissions.
It is expected behaviour. iOS terminates the app when user changes permission for Contacts, Camera, Microphone and Photos (and possibly some others).

App rejected by Apple based on design guideline

Apple rejected our app with the following response:
We noticed an issue in your app that contributes to a lower quality user experience than Apple users expect:
- Upon launching the app, a web page in mobile Safari opens first, then returns to the app. The user should be able to use the app immediately upon launch.
Next Steps
To resolve this issue, please revise your app to address all instances of this type of issue.
The app we're developing is a keyboard extension. The use-cases do not require a user to actually open the app and use it. As a result, in the app itself (should you launch it from home/springboard), we redirect the user to our website, which informs the user how to use the product (there's no registration or immediate tutorial required, but we certainly cant have the app do absolutely nothing). From Apple's response, this clearly isn't the right way. My questions:
If a user were to be redirected to Messages, could this solve the problem? The reason I ask this instead of just trying it is so that I dont waste time and end up getting rejected again.
Part of the problem seems that opening the app through springboard is misleading since it doesnt do anything. But my understanding is that we cannot have apps without icons (Create iOS app without menu icon). Do keyboard apps need to be published differently so that we dont have an icon in springboard? If so, please direct me to some documentation/Xcode configuration/resources to achieve this.
This is my first attempt at mobile development
The answer provided by #particleman was the right one. Just loading a WebView within the app was enough for Apple to accept the app.

iOS system hangs before opening App Store URL

I have a HTML page with a Download app button. When clicked by an iOS user, it redirect the users to the App Store via itms-services. The link I used here is:
window.location.replace("itms-apps://itunes.apple.com/app/id578505616");
It looks like so on a mobile browser:
Facebook/Pinterest has an in-app browser which asks for the user's consent before redirect the user out of their app in the form of an Alert box with Cancel or Open app, which Open app opens the external link. It looks like this:
It looks like this with the Alert box:
Assuming the user is using an iOS device. The expected behavior here is when the Open app button is clicked, the user gets redirected to the App Store app. However, we are seeing about a 10 seconds delay before the actual redirection happens.
See videos below:
https://www.youtube.com/watch?v=_dgh7v-IsK8
https://www.youtube.com/watch?v=_LFHeRnBFgg
https://www.youtube.com/watch?v=82Y-kj-pMyw
Notes:
I can't seem to reproduce this at all times. It is only reproducible sometimes. Sorry!
Once a device is delayed for the first time, all subsequent links to AppStores will be fast, until roughly 1 day late. Rebooting the phone and/or clearing the browser cache and/or reinstall Facebook/Pinterest does not help reproducing this.
I tried to replace the itms-apps:// link with https://itunes.apple.com/us/app/trusper-tips-tutorials-how/id578505616?mt=8, but we were still experiencing the delay from time to time.
The delay seems to be exactly 10 seconds.
Why does this delay occur? This seems like a bad user experience.
My current theory is that the problem is on the Apple side. The reason being, once the Open app button is clicked, it is out of the hand of our website, as well as Facebook/Pinterest app. I presume, once the button is clicked, iOS is handling the actual context switch from one app to another. Therefore, it suggests that either the system call actually opening the URL is hanging, or the system call opening the App Store app is?? However, I haven't been able to prove either one to be true or false. Does anyone have a better explanation?
[Edit 04/02/2015]
I can confirm this problem still exists as of today on my phone (iPhone 5S w/ iOS 8.2).
I did some further research and found this article which I think is suggesting that this is a iOS system-related bug: OpenUrl freezes app for over 10 seconds
As there is no proper documentation on how it works, it is hard to pinpoint the cause of it.
Let me advance a theory.
Opening an app from browser causes a context switch; indeed from browser to App Store. So for the very first time it'd cost some time, while in subsequent times it will open faster as it will get opened from cache.
If you consider AppStore uses Keep-alive connection between iOS AppStore in device and iOS AppStore Server for the first time socket opening in server would seem higher than the subsequent times as subsequent request would reuse the same connection.
If the app is removed from the cache then it'd again take some time for the app to open and there would be a little network delay as the app would have lost the cookie for keep-alive connection then the app would have to endure the socketing opening cost.
There are also other factors like Safari hanging, resulting in some delay. You can read how Safari can be messed up here.
iOS doesn't have garbage collection, only things like ARC (Automatic Reference Counting). Each has its own advantages and drawbacks. Sometimes these drawbacks can surface and cause some problem; nothing is to be ruled out. For example a memory leak or app-crash might leave dangling pointers.
Technically, using itms-apps should give a little advantage over plain iTunes url because itms-apps should narrow down the search; itms-apps mean iTunes Music Store-apps.
A plain iTunes URL may be a Book (iBook), Music (iTunes), App (Appstore), etc ... so iOS might have to decide which app to launch.
I hope this helps.

Prevent IOS to shutdown an app when it app switch to facebook for login and permission request

I am really stuck on this problem and I need your help!
I'm doing an ipad game with unity and the social network plugin from prime31.
The situation:
When you arrive to the end of level, the game gives you your score and ask if you want to submit it to facebook. If you do, In my script I've done a system that checks if you are logged in, if you aren't it ask you to login and then the system checks if the app has the publish permissions and if not it ask you the permission. If all theses if are true it posts a message to your wall straight. So hopefully the login/asking part needs to be done only once.
The problem:
When the ipad swap between the game and the facebook app to login, the ipad shutdown the game for saving memory. I've tried to reduce the scene, but it's hard to reduce it more than it is. So I thought maybe I should open that facebook login and authorisation inGame. For that I tried working with this:
setSessionLoginBehavior(FacebookSessionLoginBehavior.ForcingWebView);
And it does exactly what I want, it opens a small window in game, doesn't crash all good really. But the problem, in this solution, is that it only works for the login, and when I ask the publish permission it switches back to the facebook app to ask the permission and therefore crashes.
After more research, it seems that it's not doable to control the ask permission behavior.
So back to square one, how can I prevent IOS to shutdown my game while the user connects to facebook. I'm still looking to reduce the scene.
I heard of using the app url and sending data for the app (my game) launch after leaving the facebook app and therefore ask the ipad to relaunch the app at a specific scene. But that would be really the last solution because it's going to take a lot of rework to make that happened.
If you have another suggestions to work around this problem I'm up for it. All I need is login -> ask for publish permissions -> post and come back to the end of level screen of my game.
Thanks for the help
Put simply, once your app is backgrounded, if iOS wants to shut it down, you can't prevent that from happening.
The best thing you can do is save the state of your app before handing over to the facebook app for the authentication side of things, and then reload your state when the app starts up again. You'll want to handle applicationWillResignActive:, applicationDidEnterBackground:, applicationDidBecomeActive: and applicationWillBecomeActive:.
The App States and Multitasking section of the iOS App Programming Guide explains how you can do this.
I think you should check for FBDialog for iOS 5 and beneath. And FBNativeDialogs for iOS 6.
These will pop a window on the top of your app, so I guess it will still be running. And for iOS 6's FBNativeDialogs
Provides methods to display native (i.e., non-Web-based) dialogs to
the user. Currently the iOS 6 sharing dialog is supported.

Resources