2016-03-28 31 views
0

Uygulamam için bir giriş düğmesi oluşturdum, giriş ve çıkış özellikleri uygulama için çalışıyor. Şu anda sahip olduğum problem, kullanıcı uygulamaya girdikten sonra sadece bir çıkış düğmesi göstermesidir. Uygulamanın segue'i ana görünüm kontrol cihazına yönlendirmesini istiyorum. Bunun giriş yapan kullanıcı bu ekranı görüntüler ettiğinde [i ana ana ekranına doğrudan olmak için kullanıcı istiyorum ][1]Facebook düğmesinin belirli bir denetleyiciye nasıl yönlendirileceği

this is the main screen of the application, i would like the user to enter there login detail, once that has been a success i would like the user to be taken to this screen

aşağıdaki giriş ekranı için kod ve benim app temsilci

// 
// AppDelegate.m 
// SMAApplication 
// 
// Created by MOHAMMED Shakeel on 23/03/2016. 
// Copyright © 2016 MOHAMMED Shakeel. All rights reserved. 
// 

#import "AppDelegate.h" 
#import "AppDelegate.h" 
#import "DetailViewController.h" 
#import "Masterviewcontroller.h" 
#import "data.h" 
#import "FBSDKCoreKit/FBSDKCoreKit.h" 
#import <FBSDKLoginKit/FBSDKLoginKit.h> 




@interface AppDelegate() 

@end 

@implementation AppDelegate 


- (void)applicationDidBecomeActive:(UIApplication *)application { 
    [FBSDKAppEvents activateApp]; 


} 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    [FBSDKProfile enableUpdatesOnAccessTokenChange:YES]; 
    [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; 



    // Override point for customization after application launch. 


    [data getallNotes]; 
    return YES; 
} 
- (BOOL)application:(UIApplication *)application 
      openURL:(NSURL *)url 
    sourceApplication:(NSString *)sourceApplication 
     annotation:(id)annotation { 
    return [[FBSDKApplicationDelegate sharedInstance] application:application 
                  openURL:url 
               sourceApplication:sourceApplication 
                 annotation:annotation]; 




} 











- (void)applicationWillResignActive:(UIApplication *)application { 
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 
} 

- (void)applicationDidEnterBackground:(UIApplication *)application { 
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 
} 

- (void)applicationWillEnterForeground:(UIApplication *)application { 
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 
} 



- (void)applicationWillTerminate:(UIApplication *)application { 
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 
    // Saves changes in the application's managed object context before the application terminates. 
    [self saveContext]; 
} 


#pragma mark - Core Data stack 

@synthesize managedObjectContext = _managedObjectContext; 
@synthesize managedObjectModel = _managedObjectModel; 
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator; 

- (NSURL *)applicationDocumentsDirectory { 
    // The directory the application uses to store the Core Data store file. This code uses a directory named "Shakeel.StudentManagementApplication" in the application's documents directory. 
    return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; 
} 

- (NSManagedObjectModel *)managedObjectModel { 
    // The managed object model for the application. It is a fatal error for the application not to be able to find and load its model. 
    if (_managedObjectModel != nil) { 
     return _managedObjectModel; 
    } 
    NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"StudentManagementApplication" withExtension:@"momd"]; 
    _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; 
    return _managedObjectModel; 
} 
#import "LoginViewController.h" 
#import <FBSDKCoreKit/FBSDKCoreKit.h> 
#import "FBSDKLoginKit/FBSDKLoginKit.h" 


@interface LoginViewController() 



@end 

@implementation LoginViewController 
- (void)viewDidLoad { 
    [super viewDidLoad]; 
    FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init]; 
    loginButton.center = self.view.center; 
    [self.view addSubview:loginButton]; 


} 


#pragma mark - Navigation 

//In astoryboard-based application, you will often want to do a little preparation before navigation 
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 



    // Get the new view controller using [segue destinationViewController]. 
    // Pass the selected object to the new view controller. 
} 



- (IBAction)login:(id)sender { 

    [self performSegueWithIdentifier:@"main" sender:self]; 
} 
@end 

cevap

1

FBSDKLoginButton - FBSDKLoginButtonDelegate'un delege yöntemini kullanabilirsiniz.

-(void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error

{

[self performSegueWithIdentifier:@"Segueid"sender:self];

}

Bu yöntem, başarılı bir şekilde Facebook üzerinden oturum açmaya çağrılacaktır.

İlgili konular