Transaction Observer at App Start - xcode

I understand implementing a transaction observer at time of app load is recommended. I am executing below line in viewDidLoad:
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
But this causes the app to ask for user's App Store credentials at app launch which is not the behaviour we would want. What is wrong?

Related

How to access Router or (Store/Fetch) Data in an application delegate on Nativescript

I have to write an application delegate to setup call listeners for Twilio. Unfortunately, for some unknown reason, whenever I change views or call modal views, the callListeners stop working even when I declared them in the main app.component file.
So I'm thinking of just using app delegate to store the call data, tricky part is i need access to authentication service provider to check if the user has an active token
Application delegate runs outside Angular context, you may not able to get access to any Angular dependencies in there.
May be you could fire an event from delegate on application module, listen to the event form any Angular component where you would have access to any Angular dependencies.

Issues with A background URLSession with identifier

I tried this code in my project to download large files in background and it works fine. I start downloading in UIViewController. If I go to another view and back to the UIViewController ,it stop reloading the progress bar.
I got the Issues with A background URLSession with identifier already exists!. I Want to create new session every time when UIViewController load. I want invalidate all background session when dismiss the view controller. I tried all possibilities to resolve this issue but don’t get succeed.
Click Here
When you create a background session, you're doing two things:
Telling nsurlsessiond (a background daemon) to create a session.
Creating a local session in your app that is connected to that session.
The purpose of the identifier is to allow your app to reconnect to the external session (controlled by nsurlsessiond) if your app gets terminated by the operating system.
To my knowledge, it is not normally possible for your app to voluntarily dissociate its session from the background session. So when your app tries to create a session with the same identifier, suddenly there are two sessions that are both trying to talk to the same external session in nsurlsessiond, and things go very wrong. That's not a supported way to use the API.
The background session object must be kept alive the entire time that your app is running. Don't try to dispose of it and recreate it within a single launch. You should not ever create a session with the same ID unless your app gets relaunched.
Note, however, that if your app gets relaunched to handle background events (iOS only), when you call the completion handler provided by the event, your app's local session does get invalidated, and you need to create it if your app does anything after that. That's the only situation I'm aware of where a background session ever stops being associated with the background session in nsurlsessiond, and thus that's the only situation where you should ever create a session with the same ID twice in a single launch (once when you're asked to handle background events, and then potentially again when you get a didFinishLaunching call to indicate that the user foregrounded your app).

Parse.com - allow only one session per user

I have an App on Parse platform. What I need:
The User logs in on first device.
The User logs in on second device.
System revokes session on the first device.
I tried to remove objects from Session/Installation classes, but it did not help.
How can I do it?
Achieving this is not quite straightforward as there is no way to intercept login events or write cloud code triggers for Parse Session class. If you delete a client session record from the Session table, it should certainly revoke it and you end up getting authentication errors on that client. To achieve what you want, you need to write your own cloud function that logs a user in instead of using the SDK login function. That way you can first go through the Session table and revoke/delete any session associated with that user before logging in your user on the new device.

How to cache PFUser locally if it fails to sign up due to internet failure?

My app creates a PFUser in order to differentiate each sending devices. I am not using PFUser.enableautomaticuser() for some technical reason.
Also, I am using local datastore by calling Parse.enableLocalDatastore()
When internet is down and app fails to sign up using
user.signUpInBackgroundWithBlock()
it won't save this user locally either. The created PFUser is discarded, calling PFUser.currentUser() returns nil.
Then how to cache created user locally when internet is unavailable? Thank you very much!
I ended up using PFUser.enableautomaticuser() and then make changes to PFUser.currentUser().
At last I will attempt to signUp, if failed, I will call saveEventually() so that next user logs in. They will retain the previous PFUser reference, so that their information won't be lost in case the user starts the application without internet.

WP7 how to store LiveConnectSession during TombStoning?

I'm using the windows live sign in strategy of the PhotoSkyOnTheGo example provided by MS. So when my app starts, it shows a windows live sign in page.
During app runtime I remember the LiveConnectSession to connect to SkyDrive.
Now when the app tombstones, I need a way to save the LiveConnectSession. IsolatedStorageSettings.ApplicationSettings does not work, probably because the LiveConnectSession is not serializable (it shows some InvalidDataContractException in the debug output).
So how do I store the Session in case the app tombstones? Or is the provided PhotoSkyOnTheGo-example rubbish and I need to be able to reconnect anytime I'm accessing SkyDrive?
If your app uses wl.offline_access scope than the live:SignInButton control saves it for you and loads it automatically. Just use the SessionChanged event to capture the session object. This way the user will need to sign in only once.
Scope:
http://msdn.microsoft.com/en-us/library/live/hh243646.aspx#wlofflineaccess
Event:
http://msdn.microsoft.com/en-us/library/live/microsoft.live.controls.signinbutton.sessionchanged.aspx

Resources