5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

google driveでの権限(ios)

Posted at

とかのサンプルだと、作ったファイルやフォルダは見られるけど、
既にあるファイルやフォルダにアクセスできなかった。

Google Developers Consoleとかを覗いたけど、そんな設定はない。。。

解決

GTMOAuth2ViewControllerTouchを作るときの、scopeがそれだった。

つまり
kGTLAuthScopeDriveFile

kGTLAuthScopeDrive
にして解決。

obj-cだとこう。

      [[GTMOAuth2ViewControllerTouch alloc] initWithScope:kGTLAuthScopeDrive
                                                 clientID:kClientId
                                             clientSecret:kClientSecret
                                         keychainItemName:kKeychainItemName
                                                 delegate:self
                                         finishedSelector:finishedSelector];

swiftだとこう。

GTMOAuth2ViewControllerTouch(scope: kGTLAuthScopeDrive,
            clientID: kClientID,
            clientSecret: kClientSecret,
            keychainItemName: kKeychainItemName,
            delegate: self,
            finishedSelector: Selector("viewController:finishedWithAuth:error:"))

なお、scopeの選択肢には

  • kGTLAuthScopeDrive
  • kGTLAuthScopeDriveFile
  • kGTLAuthScopeDriveMetadataReadonly
  • kGTLAuthScopeDriveReadonly

があるそうだ。

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?