• TRVD1707
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I want to enclose the webView with the login insde of my app view. It's a native iOS app. I subclassed SFAuthorizingViewController and I set the authViewController in the SFAuthenticationManager to an instance of this custom subclass. My_SFAuthorizingViewController has a .xib file with the layout that I want to show, with a top navigation bar with buttons on it.
When the authorization view shows up, eventhough the class used is my custom class, the webView takes up the whole modal view and my custom .xib file is never loaded.

Here is My_SFAuthorizingViewController definition:
#import "SFAuthorizingViewController.h"

@interface MY_AuthorizingViewController : SFAuthorizingViewController
@property (nonatomic, strong) IBOutlet UINavigationBar *navigationBar;
@property (nonatomic, strong) IBOutlet UISwitch *serverToggleSwitch;

@end

I added some log information on my .m file:
#import "MY_AuthorizingViewController.h"
#import "SFAuthorizingViewController.h"

@interface MY_AuthorizingViewController ()

@end

@implementation MY_AuthorizingViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        NSLog(@"Custom Auth View initWithNib: %@",nibNameOrNil);
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    NSLog(@"Custom Auth View did Load");
    
    UIWebView *webView = (UIWebView *) self.oauthView;
    
    CGRect bounds = webView.bounds;
    MMLog(@"Bounds: %f, %f,%f, %f", bounds.origin.x,bounds.origin.y, bounds.size.width, bounds.size.height);

}

- (void)viewDidAppear:(BOOL)animated {
     NSLog(@"Custom Auth View did Appear",nil);
        CGRect bounds = self.oauthView.bounds;
    MMLog(@"Bounds: %f, %f,%f, %f", bounds.origin.x,bounds.origin.y, bounds.size.width, bounds.size.height);
}

- (void)viewWillAppear:(BOOL)animated {
    NSLog(@"Custom Auth View will Appear",nil);
        CGRect bounds = self.oauthView.bounds;
        MMLog(@"Bounds: %f, %f,%f, %f", bounds.origin.x,bounds.origin.y, bounds.size.width, bounds.size.height);
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

In my app delegate I set the authViewController in the init selector:

- (id) init {
	if ((self = [super init])) {
        [SFLogger setLogLevel:SFLogLevelDebug];
        
        // These SFAccountManager settings are the minimum required to identify the Connected App.
        [SFUserAccountManager sharedInstance].oauthClientId = kRemoteAccessConsumerKey;
        [SFUserAccountManager sharedInstance].oauthCompletionUrl = kOAuthRedirectURI;
        [[SFUserAccountManager sharedInstance ]setLoginHost: kOAuthLoginDomain];
        [SFUserAccountManager sharedInstance].scopes = [NSSet setWithObjects:@"web", @"api", nil];

        // Auth manager delegate, for receiving logout and login host change events.
        [[SFAuthenticationManager sharedManager] addDelegate:self];
        [[SFUserAccountManager sharedInstance] addDelegate:self];
        
        PL_AuthorizingViewController *avc = [[PL_AuthorizingViewController alloc] initWithNibName:@"PL_AuthorizingViewController" bundle:nil];
        [SFAuthenticationManager sharedManager].authViewController = avc;
        
        // Blocks to execute once authentication has completed.  You could define these at the different boundaries where
        // authentication is initiated, if you have specific logic for each case.
        __weak PL_AppDelegate *weakSelf = self;
        self.initialLoginSuccessBlock = ^(SFOAuthInfo *info) {
            [weakSelf setupRootViewController];
        };
        self.initialLoginFailureBlock = ^(SFOAuthInfo *info, NSError *error) {
            [[SFAuthenticationManager sharedManager] logout];
        };

	}
	return self;
}


 

Since last couple of weeks my mobile application using OAuth 2.0 is unable to get a new access token using the refresh token. The refresh token seems to be revoked at the same time the access token is expired. We tested this by making the access token to expired every 15 minutes. We are able to connect our app, use it for 15 min and after that we get an error "refresh token revoked" when trying to refresh the access token. 
 
The app was working fine before, being able to refresh the access token for days at a time with the acess token expiring every 2 hours. The mobile app is using libSalesforceOAuth.a (SalesforceOAuth). File preview on Mac shows version as 69c556c0b958. I got this library by downloading SalesforceMobileSDK-iOS on 10/03/2013. The zip file SalesforceOAuth-Release.zip on this download has the date of 09/19/2013

Thanks,
Teresa
 Hi,     
       I am eagerly waiting for 64 bit iOS comaptible salesforce sdk. Please let me know about it. 


-Loganathan