0

GDrive クイックスタート iOS ページ ( https://developers.google.com/drive/quickstart-ios ) でビデオを見ました。私はそれを一歩一歩たどり、iPhoneアプリで何度か再試行し、さらにビデオを見ました. GDrive を既存の iPhone アプリに統合しようとしています。

GTMOAuth2ViewControllerTouch.h と GTLDrive.h をインポートし、これを .h ファイルに追加しました: @property (nonatomic, strong) GTLServiceDrive *driveService;

.m :

// Helper to check if user is authorized
- (BOOL)isAuthorized
{
    return [((GTMOAuth2Authentication *)self.driveService.authorizer) canAuthorize];
}


// Handle completion of the authorization process, and updates the Drive service
// with the new credentials.
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
      finishedWithAuth:(GTMOAuth2Authentication *)authResult
                 error:(NSError *)error
{
    if (error != nil)
    {
        NSLog(@"Authentication Error - %@", error.localizedDescription);
        self.driveService.authorizer = nil;
    }
    else
    {
        self.driveService.authorizer = authResult;
    }
}


-(void) uploadFile : (NSString *) appFile {

    NSLog(@"uploadFile %@", appFile);

    // Initialize the drive service & load existing credentials from the keychain if available
    self.driveService = [[GTLServiceDrive alloc] init];
    self.driveService.authorizer = [GTMOAuth2ViewControllerTouch
                                    authForGoogleFromKeychainForName : kGDriveKeychainItem
                                    clientID : kGDriveClientID
                                    clientSecret : kGDriveClientSecret];
    NSLog(@"auth done");

    GTLDriveFile *file = [GTLDriveFile object];
    file.title = fileStat;
    file.descriptionProperty = @"App Info";
    file.mimeType = @"text/plain";

    NSData *data = [NSData dataWithContentsOfFile : appFile];
    GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithData:data MIMEType:file.mimeType];
    GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:file
                                                       uploadParameters:uploadParameters];

    NSLog(@"Uploading to GDrive");
    [self.driveService executeQuery:query
                  completionHandler:^(GTLServiceTicket *ticket,
                                      GTLDriveFile *insertedFile, NSError *error) {
                      if (error == nil)
                      {
                          NSLog(@"File ID: %@ ; GDrive file saved!", insertedFile.identifier);
                      }
                      else
                      {
                          NSLog(@"GDrive - An error occurred: %@", error);
                      }
                  }];
}

エラーが発生しています

dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty_nonatomic_copy
  Expected in: /usr/lib/libobjc.A.dylib

「upload file」行の後 (この行を出力してからクラッシュします)。

誰か助けてくれませんか?

4

0 に答える 0