IOS 응용 프로그램을 구현하려고합니다. 내 응용 프로그램의 필요성은 DropBox 응용 프로그램 (내 아이폰은 DropBox 응용 프로그램이 있습니다)에서 문서 (pdf, 사진 등)에 액세스하는 것입니다. 나는 DropBox에서 문서에 액세스하는 것에 대해 전혀 모른다.iOS 응용 프로그램의 DropBox에서 문서에 액세스하는 방법
누구든지 나를 도와주세요. 미리 감사드립니다.
IOS 응용 프로그램을 구현하려고합니다. 내 응용 프로그램의 필요성은 DropBox 응용 프로그램 (내 아이폰은 DropBox 응용 프로그램이 있습니다)에서 문서 (pdf, 사진 등)에 액세스하는 것입니다. 나는 DropBox에서 문서에 액세스하는 것에 대해 전혀 모른다.iOS 응용 프로그램의 DropBox에서 문서에 액세스하는 방법
누구든지 나를 도와주세요. 미리 감사드립니다.
먼저 Dropbox iOS SDK가 필요합니다. 그런 다음 Dropbox 웹 사이트 (MyApp 선택)에서 얻을 수있는 응용 프로그램 키가 필요합니다. Dropbox iOS SDK에는 번들로 제공되는 데모 애플리케이션이 포함되어 있으므로 유의하시기 바랍니다. 또한 좋은 시작 자습서는 here입니다. 아이폰 OS 보관 용 SDK는 아이폰 OS 4.2 이상이 필요합니다 있습니다
NSString* consumerKey; //fill your key
NSString* consumerSecret ; //fill your secret
DBSession* session = [[DBSession alloc] initWithConsumerKey:consumerKey
consumerSecret:consumerSecret];
session.delegate = self;
[DBSession setSharedSession:session];
[session release];
if (![[DBSession sharedSession] isLinked])
{
DBLoginController* controller = [[DBLoginController new] autorelease];
controller.delegate = self;
[controller presentFromController:self];
}
DBRestClient *rc = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
self.restClient = rc;
[rc release];
self.restClient.delegate = self;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"SampleFile.txt"];
[self.restClient loadFile:@"/example/SampleFile.txt" intoPath:filePath];
:
파일에 액세스하려면 코드는 같을 것이다.
UIDocumentMenuViewController
클래스를 사용하면 파일을 공유하는 다른 앱의 파일에 액세스 할 수 있습니다. 당신은 당신은 문서를 선택해 화면의이 종류를 볼 수 UTI
's here
import MobileCoreServices
class ViewController: UIViewController, UITextFieldDelegate, UIDocumentPickerDelegate, UIDocumentMenuDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func handleImportPickerPressed(sender: AnyObject) {
let documentPicker = UIDocumentMenuViewController(documentTypes: [kUTTypePDF as String], in: .import)
documentPicker.delegate = self
present(documentPicker, animated: true, completion: nil)
}
// MARK:- UIDocumentMenuDelegate
func documentMenu(_ documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
documentPicker.delegate = self
present(documentPicker, animated: true, completion: nil)
}
// MARK:- UIDocumentPickerDelegate
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
// Do something
print("\(url)")
}
}
모든
당신은 다른 응용 프로그램의 문서에 액세스 할 수 없습니다 찾을 수 있습니다. Dropbox API를 사용해야합니다. http://stackoverflow.com/questions/3502649/accessing-dropbox-in-your-iphone-app –
재생 해 주셔서 감사합니다. – John