| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Version 1.0
Microsoft Open Technologies, Inc. (MS Open Tech) has built the OneNote Picker for iOS, an open source project that strives to help iOS developers use the OneNote API from their apps.
Tools and Libraries you will need to download, install, and configure for your development environment to use the OneNotePickerLibrary.
Accounts
###Build and Reference the Library
To build OneNotePicker.framework,...
To include OneNotePicker.framework in a project,...
The OneNotePickerLibrary provides a class called OneNotePickerController that is a subclass of the UINavigationController class.
####Input
Specify the required and optional properties for the OneNotePickerController class:
####OneNotePickerControllerDelegate methods
The methods of this protocol notify the delegate when the user either picks a section or cancels the picker operation, or when the picker is dismissed because of an error in the API or on the device.
Three delegate methods are responsible for dismissing the picker when the operation completes. To close the picker, call the dismissViewControllerAnimated: method of the controller responsible for displaying the OneNotePickerController object.
When the user successfully picks a section, the delegate passes back information about the user's selection through the oneNotePickerController:didFinishPickingSectionWithInfo: method:
(void)oneNotePickerController:(OneNotePickerController *) picker didFinishPickingSectionWithInfo:(NSDictionary *)info
The picker parameter is the controller that manages the picker interface. The info parameter is a dictionary containing the information about the section that the user selected. The info dictionary contains the following keys:
When the user cancels the picker operation, the delegate notifies you that this has happened through the oneNotePickerControllerDidCancel: method:
(void)oneNotePickerControllerDidCancel:(OneNotePickerController *)picker
The picker parameter is the controller that manages the picker interface.
When the picker operation fails because of an error generated by the OneNote API or by a system exception on the device, the delegate passes information about the error or exception through the oneNotePickerController:didErrorWithInfo: method:
(void)oneNotePickerController:(OneNotePickerController *)picker didErrorWithInfo:(NSDictionary *)info
The picker parameter is the controller that manages the picker interface. The info parameter is a dictionary containing the information about the API error or system exception. The info dictionary contains the following keys:
####Example
The following example shows how to create a new instance of the OneNotePickerController class, set the required and optional values, and handle errors and exceptions that might be returned. The following code is in a header file called ExampleController.h:
#import <UIKit/UIKit.h>
@interface ExampleController : UIViewController <UINavigationControllerDelegate, OneNotePickerControllerDelegate> {
OneNotePickerController *oneNotePicker;
}
@end
The following code is in the .m file:
#import "ExampleController.h"
@interface ExampleController ()
- (void)createOneNotePicker;
@end
@implementation ExampleController
- (void)createOneNotePicker {
oneNotePicker = [[OneNotePickerController alloc] init];
oneNotePicker.accessToken = @"<INSERT OAuth TOKEN HERE>";
oneNotePicker.headerInstructions = @"Please choose a section in which to create your note.";
oneNotePicker.delegate = self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self createOneNotePicker];
}
- (void)viewWillAppear:(BOOL)animated {
[self presentViewController:oneNotePicker animated:animated completion:nil];
}
- (void)oneNotePickerController:(OneNotePickerController *)picker didFinishPickingSectionWithInfo:(NSDictionary *)info {
//Store the information.
NSString *sectionID = [info valueForKey:OneNotePickerControllerSectionID];
NSString *sectionName = [info valueForKey:OneNotePickerControllerSectionName];
NSURL *pagesURL = [info valueForKey:OneNotePickerControllerPagesURL];
NSDate *createdTime = [info valueForKey:OneNotePickerControllerCreatedTime];
NSDate *modifiedTime = [info valueForKey:OneNotePickerControllerModifiedTime];
NSString *lastModifiedBy = [info valueForKey:OneNotePickerControllerLastModifiedBy];
//Do something with the information.
}
- (void)oneNotePickerControllerDidCancel:(OneNotePickerController *)picker {
//Do something if the user cancels.
}
- (void)oneNotePickerController:(OneNotePickerController *)picker didErrorWithInfo:(NSDictionary *)info {
//Handle an API error.
NSNumber *isAPIError = [info valueForKey:OneNotePickerControllerIsAPIError];
if([isAPIError boolValue]) {
//Store API error values.
NSString *errorCode = [info valueForKey:OneNotePickerControllerAPIErrorCode];
NSString *errorString = [info valueForKey:OneNotePickerControllerAPIErrorName];
NSURL *errorURL = [info valueForKey:OneNotePickerControllerAPIErrorURL];
//Do something with the API error information.
}
else {
//Handle system error.
NSError *systemError = [info valueForKey:OneNotePickerControllerSystemError];
//Do something with the system error information.
}
}
The following aspects of the API are used in this library. You can find additional documentation at the links below.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
| Back | FazBrowse Home | New Git URL |