I have a TabBar layout and in the Home tab i have a button "Connect" which when pressed sends an action to the class TransferViewController to create a GameKit Session. Then i have another tab called Send which has a button that says "Send File" which when pressed sends an action to the class TransferViewController also which uses the "Session" variable that was setup using connect to send a file but since it is a different tab it creates a new instance of the Controller and it wants me to connect again but the button is on the Home tab.
Is there anyway that I can have one Controller for two tabs without having two instances? I want the user to click connect on the Home tab then switch to the Send tab and press Send File and use the variables setup by connect on the other tab. I'm sorry if this is confusing.
This is not confusing at all - in fact, this comes up all the time. The way this works in model-view-controller systems is that you set up a model class, make it a singleton, and add references to that singleton in all controllers that need to share the data.
Model.h
Model.m
Now you can use the shared session in your controller code: import
"Model.h"
, and write