Storing accessToken in Facebook iOS SDK -
i have facebook ios sdk set in app. however, have trouble determining when session finished. how check if it's finished, , (how) store access token received login?
i need determine whether have access token or not right beginning know whether log in again, or go forward in app.
are familiar nsuserdefaults ? storing preferences app.
they extremely easy use, , looking for. it's ..
nsuserdefaults *factoids; nsstring *whateveridstring; // make property convenience factoids = [nsuserdefaults standarduserdefaults]; self.whateveridstring = [factoids stringforkey:@"storethestringhere"]; if ( ( whateveridstring == nil ) || ( [whateveridstring isequaltostring:@""] ) ) // not yet exist, try make new one... else // made 1 last time program ran // when make new one, save in prefs file this... [factoids setobject:yournewstring forkey:@"storethestringhere"]; [factoids synchronize]; hope helps!
one preferences in 'factoids' in example above
two decide on name preference. 'storethestringhere' in example.
three string 'whateveridstring' in example using stringforkey:
four check if either nil or blank. if so, start fresh.
five once value, save shown!
hope helps!
Comments
Post a Comment