J'ai créé une application IPhone et une bibliothèque de lecteurs google intégrée dans le projet et j'ai également défini le paramètre requis dans le paramètre de construction. Je "obtiens ci-dessous erreur lors de la compilation. S'il vous plaît quelqu'un peut me aider avec ceErreur d'intégration de Google Drive dans l'iphone
#import "ViewController.h"
#import "GTMOAuth2ViewControllerTouch.h"
#import "GTLService.h"
#import "GTLQueryDrive.h"
#import "GTLDrive.h"
#import "GDUTILITY.h"
@implementation ViewController
@synthesize authButton; @synthesize addMoreButton; @synthesize
btnRefresh;
@synthesize isAuthorized; @synthesize driveService; @synthesize
driveFiles;
#define kKeychainItemName111 @"GDDEMOTESTERNONARC: Google Drive"
#define kClientId111 @"16458548056-efdl07vmtam1pa159ln9024gc239oted.apps.googleusercontent.com"
#define kClientSecret111 @"yJU-avQu3Y0dlu3tL9ooLDRo"
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use. }
#pragma mark - View lifecycle
- (void)viewDidLoad {
[super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib.
GTMOAuth2Authentication *auth =[GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:kKeychainItemName111
clientID:kClientId111 clientSecret:kClientSecret111];
if ([auth canAuthorize])
{
[self isAuthorizedWithAuthentication:auth];
}
}
- (GTLServiceDrive *)driveService {
static GTLServiceDrive *service = nil;
if (!service)
{
service = [[GTLServiceDrive alloc] init];
// Have the service object set tickets to fetch consecutive pages
// of the feed so we do not need to manually fetch them.
service.shouldFetchNextPages = YES;
// Have the service object set tickets to retry temporary error conditions
// automatically.
service.retryEnabled = YES;
}
return service; }
- (IBAction)authButtonMethos:(id)sender {
if (!self.isAuthorized)
{
// Sign in.
SEL finishedSelector = @selector(viewController:finishedWithAuth:error:);
GTMOAuth2ViewControllerTouch *authViewController =[[GTMOAuth2ViewControllerTouch alloc] initWithScope:kGTLAuthScopeDriveFile clientID:kClientId111
clientSecret:kClientSecret111 keychainItemName:kKeychainItemName111
delegate:self finishedSelector:finishedSelector];
[self presentModalViewController:authViewController animated:YES];
}
else
{
// Sign out
[GTMOAuth2ViewControllerTouch removeAuthFromKeychainForName:kKeychainItemName111];
[[self driveService] setAuthorizer:nil];
// self.authButton.title = @"Sign in";
self.isAuthorized = NO;
// [self toggleActionButtons:NO];
[self.driveFiles removeAllObjects];
}
}
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error {
[self dismissModalViewControllerAnimated:YES];
if (error == nil)
{
[self isAuthorizedWithAuthentication:auth];
} }
- (void)isAuthorizedWithAuthentication:(GTMOAuth2Authentication *)auth {
[[self driveService] setAuthorizer:auth];
// self.authButton.title = @"Sign out";
self.isAuthorized = YES;
// [self toggleActionButtons:YES];
[self loadDriveFiles]; }
- (void)loadDriveFiles {
GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q = @"mimeType = 'text/plain'";
UIAlertView *alert = [GDUTILITY showLoadingMessageWithTitle:@"Loading files"
delegate:self];
[self.driveService executeQuery:query completionHandler:^(GTLServiceTicket *ticket,
GTLDriveFileList *files,
NSError *error)
{
[alert dismissWithClickedButtonIndex:0 animated:YES];
if (error == nil) {
if (self.driveFiles == nil)
{
self.driveFiles = [[NSMutableArray alloc] init];
}
[self.driveFiles removeAllObjects];
[self.driveFiles addObjectsFromArray:files.items];
// [self.tableView reloadData];
}
else
{
NSLog(@"An error occurred: %@", error);
[GDUTILITY showErrorMessageWithTitle:@"Unable to load files"
message:[error description]
delegate:self];
}
}];
NSLog(@"Click on the login button");
}
Je suis en ce code sur simulator.So Je reçois ci-dessous erreur
ld: duplicate symbol _OBJC_METACLASS_$_GTLDriveAbout in
/Users/bcod/Library/Developer/Xcode/DerivedData/GoogleDDemo-frrwjztsgtylsxbmkifnctrxzjfh/Build/Intermediates/GoogleDDemo.build/Debug-iphonesimulator/GoogleDDemo.build/Objects-normal/i386/GTLDriveAbout.o
and
/Users/bcod/Library/Developer/Xcode/DerivedData/GoogleDDemo-frrwjztsgtylsxbmkifnctrxzjfh/Build/Intermediates/GoogleDDemo.build/Debug-iphonesimulator/GoogleDDemo.build/Objects-normal/i386/GTLDrive_Sources.o
for architecture i386
Merci à l'avance
peut vous montrer peu de code binaire .. – Ayaz
Vous avez montré le mauvais code. Démarrez Terminal.app, accédez au répertoire Source et publiez la sortie de '$ fgrep GTLDriveAbout * .m'. – trojanfoe
Aussi, essayez de vérifier l'utilisation de #include (dans le fichier h ou m) ... essayez de supprimer/commenter (étape par étape) #import "GTLService.h" ... "GTLQueryDrive.h" .. "GDUTILITY.h " – TonyMkenu