Breaking News
Home / iOS / iOS Snippets (page 2)

iOS Snippets

FBSession: an attempt was made reauthorize permissions on an unopened session

Issue When an attempt is made to Re-Authorize the Facebook session using the Facebook iOS SDK, the following exception is thrown. 2012-09-30 01:37:46.377 [7894:17c03] *** Terminating app due to uncaught exception ‘com.facebook.sdk:InvalidOperationException’, reason: ‘FBSession: an attempt was made reauthorize permissions on an unopened session’*** First throw call stack: Solution Make …

Read More »

What are the various Enums used by the Facebook iOS SDK?

The following are the various Enumeration defined and used by the Facebook iOS SDK. Please review these for full understanding of how the SDK behaves for various operations. /*  * Constants used by NSNotificationCenter for active session notification  */     /*! NSNotificationCenter name indicating that a new active session …

Read More »

What is the location of files under the Documents Directory for an iOS app?

Answer In Simulator /Users/<YOURUSER>/Library/Application Support/iPhone Simulator/<IOS-VERSION>/Applications/<APPID>/Documents/<your-file-name> YOURUSER – Username you are logged in as IOS-VERSION – The one you are running the app under ex. 6.0 APPID – A unique alphanumeric ID given to your app. Once you delete/clean your app it creates a new one. your-file-name  – The file …

Read More »

How to change font to bold and color of a UILabel?

Snippet The following snippet provides a utiity method to change the label font from bold to regular along with that it changes the color to red or black respectively –(void) updateLabel :(UILabel*) field emphasis :(BOOL) emphasis {     if (emphasis)     {         field.textColor = …

Read More »

How to load image from PhotoGallery into a CCSprite?

Sinppet The Asset Library is used here, so add import. #import “AssetsLibrary/AssetsLibrary.h”     CCSprite *playPhoto;   CCLOG(@”Photo %@”,dataManager.playerPhoto); // check if the URL is an asset URL from the Photo Gallery.     if(dataManager.playerPhoto != nil && [dataManager.playerPhoto rangeOfString:@”asset”].location !=NSNotFound)    {                NSURL *referenceURL = [[NSURL alloc] initWithString:dataManager.playerPhoto];                ALAssetsLibrary …

Read More »
Advertisment ad adsense adlogger