├── test.png ├── Graph-iOS-Swift-Connect ├── Assets.xcassets │ ├── Contents.json │ ├── Image.imageset │ │ ├── test.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Graph-iOS-Swift-Connect-Bridging-Header.h ├── ApplicationConstants.swift ├── Localizable.strings ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Authentication.swift ├── AppDelegate.swift ├── EmailBody.html ├── ConnectViewController.swift └── SendViewController.swift ├── Graph-iOS-Swift-ConnectTests ├── testUserArgs.json ├── preTest.sh ├── Info.plist ├── testAuthProvider.swift └── Graph_iOS_Swift_ConnectTests.swift ├── Podfile ├── Graph-iOS-Swift-Connect.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ └── Graph-iOS-Swift-Connect.xcscheme └── project.pbxproj ├── Graph-iOS-Swift-Connect.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── Graph-iOS-Swift-Connect.xcscmblueprint ├── .gitignore ├── License.txt ├── README-Localized ├── README-zh-cn.md ├── README-zh-tw.md ├── README-ja-jp.md ├── README-ru-ru.md ├── README-pt-br.md ├── README-es-es.md ├── README-fr-fr.md └── README-de-de.md └── Readme.md /test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoftgraph/ios-swift-connect-sample/master/test.png -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Graph-iOS-Swift-ConnectTests/testUserArgs.json: -------------------------------------------------------------------------------- 1 | { 2 | "test.clientId" : "ENTER_CLIENT_ID", 3 | "test.username" : "ENTER_USERNAME", 4 | "test.password" : "ENTER_PASSWORD" 5 | } 6 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Assets.xcassets/Image.imageset/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoftgraph/ios-swift-connect-sample/master/Graph-iOS-Swift-Connect/Assets.xcassets/Image.imageset/test.png -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '6.0' 3 | 4 | target 'Graph-iOS-Swift-Connect' do 5 | pod 'MSGraphSDK' 6 | pod 'MSGraphSDK-NXOAuth2Adapter' 7 | end 8 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Graph-iOS-Swift-Connect-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | #import 7 | #import 8 | #import 9 | 10 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Assets.xcassets/Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "test.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Graph-iOS-Swift-ConnectTests/preTest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | get_script_dir () { 3 | SOURCE="${BASH_SOURCE[0]}" 4 | while [ -h "$SOURCE" ]; do 5 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 6 | SOURCE="$( readlink "$SOURCE" )" 7 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" 8 | done 9 | $( cd -P "$( dirname "$SOURCE" )" ) 10 | pwd 11 | } 12 | 13 | FILE="$(get_script_dir)/testUserArgs.json" 14 | 15 | /bin/cat <$FILE 16 | { 17 | "test.clientId" : "$1", 18 | "test.username" : "$2", 19 | "test.password" : "$3" 20 | } 21 | EOM 22 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/ApplicationConstants.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | 7 | import Foundation 8 | 9 | struct ApplicationConstants { 10 | static let clientId = "ENTER_YOUR_CLIENT_ID" 11 | static let scopes = ["mail.send","Files.ReadWrite","User.ReadBasic.All"] 12 | } 13 | 14 | 15 | /** 16 | Simple construct to encapsulate NSError. This could be expanded for more types of graph errors in future. 17 | */ 18 | enum MSGraphError: Error { 19 | case nsErrorType(error: NSError) 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | 3 | ## Build generated 4 | build/ 5 | DerivedData/ 6 | 7 | ## Various settings 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata/ 17 | 18 | ## Other 19 | *.moved-aside 20 | *.xcuserstate 21 | 22 | ## Obj-C/Swift specific 23 | *.hmap 24 | *.ipa 25 | *.dSYM.zip 26 | *.dSYM 27 | *.xcworkspace 28 | 29 | ## Playgrounds 30 | timeline.xctimeline 31 | playground.xcworkspace 32 | 33 | # Swift Package Manager 34 | # 35 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 36 | # Packages/ 37 | .build/ 38 | 39 | # CocoaPods 40 | # 41 | Pods/ 42 | *Podfile.lock 43 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-ConnectTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | 4 | Copyright (c) 2016 Microsoft 5 | 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | 7 | // ConnectViewController 8 | "CONNECT" = "Connect"; 9 | "CONNECTING" = "Connecting..."; 10 | 11 | // SendViewController 12 | "DISCONNECT" = "Disconnect"; 13 | "DESCRIPTION" = "You're now connected to Office 365.\nTap the Send button below to send a message from your account using the iOS Microsoft Graph SDK."; 14 | 15 | "SEND" = "Send"; 16 | "SEND_FAILURE" = "Send mail has failed. Please look at the log for more details."; 17 | "SEND_SUCCESS" = "Mail sent successfully."; 18 | 19 | "LOADING_USER_INFO" = "Loading user information"; 20 | "GRAPH_ERROR" = "Graph Error."; 21 | "USER_INFO_LOAD_FAILURE" = "User information loading failed."; 22 | "HI_USER" = "Hi %@"; 23 | "USER_INFO_LOAD_SUCCESS" = "User information loaded."; 24 | 25 | "MAIL_SUBJECT" = "Mail received from the Office 365 iOS Microsoft Graph SDK Sample"; 26 | 27 | // Common 28 | "GRAPH_TITLE" = "Microsoft Graph Connect"; 29 | "CHECK_LOG_ERROR" = "Check print log for error details"; 30 | "ERROR" = "Error"; 31 | "CLOSE" = "Close"; 32 | 33 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect.xcworkspace/xcshareddata/Graph-iOS-Swift-Connect.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "372174C4CA02CA7F916AA58D6A6B26327D6B7907", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "E578364CA79A995DDB1916E193A9960A5CEB2B9B" : 9223372036854775807, 8 | "372174C4CA02CA7F916AA58D6A6B26327D6B7907" : 9223372036854775807 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "F8574656-A779-472B-924B-E7DD0BFFED00", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "E578364CA79A995DDB1916E193A9960A5CEB2B9B" : "microsoft-authentication-library-for-objc\/", 13 | "372174C4CA02CA7F916AA58D6A6B26327D6B7907" : "ios-swift-connect-sample\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "Graph-iOS-Swift-Connect", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Graph-iOS-Swift-Connect.xcworkspace", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/microsoftgraph\/ios-swift-connect-sample.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "372174C4CA02CA7F916AA58D6A6B26327D6B7907" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/AzureAD\/microsoft-authentication-library-for-objc.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E578364CA79A995DDB1916E193A9960A5CEB2B9B" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Authentication.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | 7 | import Foundation 8 | 9 | struct Authentication { 10 | var authenticationProvider: NXOAuth2AuthenticationProvider? 11 | { 12 | get { 13 | return NXOAuth2AuthenticationProvider.sharedAuth() 14 | } 15 | } 16 | } 17 | 18 | extension Authentication { 19 | /** 20 | Authenticates to Microsoft Graph. 21 | If a user has previously signed in before and not disconnected, silent log in 22 | will take place. 23 | If not, authentication will ask for credentials 24 | */ 25 | func connectToGraph(withClientId clientId: String, 26 | scopes: [String], 27 | completion:@escaping (_ error: MSGraphError?) -> Void) { 28 | 29 | // Set client ID 30 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 31 | 32 | // Try silent log in. This will attempt to sign in if there is a previous successful 33 | // sign in user information. 34 | if NXOAuth2AuthenticationProvider.sharedAuth().loginSilent() == true { 35 | completion(nil) 36 | } 37 | // Otherwise, present log in controller. 38 | else { 39 | NXOAuth2AuthenticationProvider.sharedAuth() 40 | .login(with: nil) { (error: Error?) in 41 | 42 | if let nserror = error { 43 | completion(MSGraphError.nsErrorType(error: nserror as NSError)) 44 | } 45 | else { 46 | completion(nil) 47 | } 48 | } 49 | } 50 | } 51 | 52 | func disconnect() { 53 | NXOAuth2AuthenticationProvider.sharedAuth().logout() 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | 7 | import UIKit 8 | 9 | @UIApplicationMain 10 | class AppDelegate: UIResponder, UIApplicationDelegate { 11 | 12 | var window: UIWindow? 13 | 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 16 | // Override point for customization after application launch. 17 | return true 18 | } 19 | 20 | func applicationWillResignActive(_ application: UIApplication) { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | func applicationDidEnterBackground(_ application: UIApplication) { 26 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 27 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 28 | } 29 | 30 | func applicationWillEnterForeground(_ application: UIApplication) { 31 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 32 | } 33 | 34 | func applicationDidBecomeActive(_ application: UIApplication) { 35 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 36 | } 37 | 38 | func applicationWillTerminate(_ application: UIApplication) { 39 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 40 | } 41 | 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/EmailBody.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Congratulations!

8 |

This is a message from the Microsoft Graph Connect Sample. You are well on your way to incorporating Microsoft Graph endpoints in your apps.

See the photo you just uploaded! 9 |

What's next?

    10 |
  • Check out developer.microsoft.com/graph to start building Microsoft Graph apps today with all the latest tools, templates, and guidance to get started quickly.
  • 11 |
  • Use the Graph Explorer to explore the rest of the APIs and start your testing.
  • 12 |
  • Browse other samples on GitHub to see more of the APIs in action.
  • 13 |
14 |

Give us feedback

15 |

If you have any trouble running this sample, please 16 | log an issue on our repository.

For general questions about the Microsoft Graph API, post to Stack Overflow. Make sure that your questions or comments are tagged with [microsoftgraph].

17 |

Thanks, and happy coding!
18 | Your Microsoft Graph samples development team

19 |
20 | 21 | 22 | 23 | 25 | 27 | 29 | 30 | 31 |
See on GitHub 24 | Suggest on UserVoice 26 | Share on Twitter 28 |
32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/ConnectViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | 7 | import Foundation 8 | import UIKit 9 | 10 | class ConnectViewController: UIViewController { 11 | 12 | @IBOutlet var activityIndicator: UIActivityIndicatorView! 13 | @IBOutlet var connectButton: UIButton! 14 | 15 | let authentication: Authentication = Authentication() 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | title = NSLocalizedString("Microsoft Graph Connect", comment: "") 21 | connectButton.setTitle(NSLocalizedString("CONNECT", comment: ""), for: UIControlState()) 22 | } 23 | 24 | 25 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 26 | // There is only one segue 27 | let sendViewController: SendViewController = segue.destination as! SendViewController 28 | sendViewController.authentication = authentication 29 | } 30 | } 31 | 32 | 33 | // MARK: Actions 34 | private extension ConnectViewController { 35 | @IBAction func connectToGraph(_ sender: AnyObject) { 36 | authenticate() 37 | } 38 | } 39 | 40 | 41 | // MARK: Authentication 42 | private extension ConnectViewController { 43 | func authenticate() { 44 | loadingUI(show: true) 45 | 46 | let clientId = ApplicationConstants.clientId 47 | let scopes = ApplicationConstants.scopes 48 | 49 | authentication.connectToGraph(withClientId: clientId, scopes: scopes) { 50 | (error) in 51 | 52 | defer {self.loadingUI(show: false)} 53 | 54 | if let graphError = error { 55 | switch graphError { 56 | case .nsErrorType(let nsError): 57 | print(NSLocalizedString("ERROR", comment: ""), nsError.localizedDescription) 58 | self.showError(message: NSLocalizedString("CHECK_LOG_ERROR", comment: "")) 59 | } 60 | } 61 | else { 62 | self.performSegue(withIdentifier: "showSendMail", sender: nil) 63 | } 64 | } 65 | } 66 | } 67 | 68 | 69 | // MARK: UI Helper 70 | private extension ConnectViewController { 71 | func loadingUI(show: Bool) { 72 | if show { 73 | self.activityIndicator.startAnimating() 74 | self.connectButton.setTitle(NSLocalizedString("CONNECTING", comment: ""), for: UIControlState()) 75 | self.connectButton.isEnabled = false; 76 | } 77 | else { 78 | self.activityIndicator.stopAnimating() 79 | self.connectButton.setTitle(NSLocalizedString("CONNECT", comment: ""), for: UIControlState()) 80 | self.connectButton.isEnabled = true; 81 | } 82 | } 83 | 84 | func showError(message:String) { 85 | DispatchQueue.main.async(execute: { 86 | let alertControl = UIAlertController(title: NSLocalizedString("ERROR", comment: ""), message: message, preferredStyle: .alert) 87 | alertControl.addAction(UIAlertAction(title: NSLocalizedString("CLOSE", comment: ""), style: .default, handler: nil)) 88 | 89 | self.present(alertControl, animated: true, completion: nil) 90 | }) 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-ConnectTests/testAuthProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // testAuthProvider.swift 3 | // Graph-iOS-Swift-Connect 4 | // 5 | // Created by Jason Kim on 6/23/16. 6 | // Copyright © 2016 Jason Kim. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @testable import Graph_iOS_Swift_Connect 12 | 13 | class testAuthProvider: NSObject, MSAuthenticationProvider { 14 | 15 | var accessToken: String = "" 16 | 17 | let contentType = "application/x-www-form-urlencoded" 18 | let grantType = "password" 19 | let tokenEndPoint = "https://login.microsoftonline.com/common/oauth2/token" 20 | let requestType = "POST" 21 | let resourceId = "https://graph.microsoft.com" 22 | 23 | let tokenType = "bearer" 24 | let apiHeaderAuthrization = "Authorization" 25 | 26 | @objc func appendAuthenticationHeaders(_ request: NSMutableURLRequest!, completion completionHandler: MSAuthenticationCompletion!) { 27 | 28 | if accessToken != "" { 29 | let oauthAuthorizationHeader = String(format: "%@ %@", tokenType, accessToken) 30 | request.setValue(MS_API_HEADER_AUTHORIZATION, forHTTPHeaderField: oauthAuthorizationHeader) 31 | completionHandler(request, nil) 32 | } 33 | else { 34 | let path = Bundle(for: type(of: self)).path(forResource: "testUserArgs", ofType: "json") 35 | 36 | let jsonData = try! Data(contentsOf: URL(fileURLWithPath: path!), options: .mappedIfSafe) 37 | let jsonResult = try! JSONSerialization.jsonObject(with: jsonData, options: []) as! NSDictionary 38 | 39 | let username = jsonResult["test.username"] as! String 40 | let password = jsonResult["test.password"] as! String 41 | let clientId = jsonResult["test.clientId"] as! String 42 | 43 | let authRequest = NSMutableURLRequest() 44 | let bodyString = "grant_type=\(grantType)&resource=\(resourceId)&client_id=\(clientId)&username=\(username)&password=\(password)" 45 | 46 | authRequest.url = URL(string: tokenEndPoint) 47 | authRequest.httpMethod = requestType 48 | authRequest.setValue(contentType, forHTTPHeaderField: "Content_Type") 49 | authRequest.httpBody = bodyString.data(using: String.Encoding.utf8) 50 | 51 | let session = URLSession.shared 52 | let task = session.dataTask(with: authRequest, completionHandler: { (data: Data?, response: URLResponse?, error: NSError?) in 53 | 54 | if let validData = data { 55 | let jsonDictionary = try! JSONSerialization.jsonObject(with: validData, options: .allowFragments) as! NSDictionary 56 | if let accessTokenReturned = jsonDictionary["access_token"] { 57 | self.accessToken = accessTokenReturned as! String 58 | } 59 | else { 60 | self.accessToken = "WRONG_TOKEN" 61 | } 62 | } 63 | 64 | let oauthAuthorizationHeader = String(format: "%@ %@", self.tokenType, self.accessToken) 65 | request.setValue(oauthAuthorizationHeader, forHTTPHeaderField: self.apiHeaderAuthrization) 66 | 67 | completionHandler(request, error) 68 | }) 69 | task.resume() 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-ConnectTests/Graph_iOS_Swift_ConnectTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Graph_iOS_Swift_ConnectTests.swift 3 | // Graph-iOS-Swift-ConnectTests 4 | // 5 | // Created by Jason Kim on 6/22/16. 6 | // Copyright © 2016 Jason Kim. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | import UIKit 11 | @testable import Graph_iOS_Swift_Connect 12 | 13 | class Graph_iOS_Swift_ConnectTests: XCTestCase { 14 | 15 | var graphClient: MSGraphClient! 16 | 17 | override func setUp() { 18 | super.setUp() 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | 21 | MSGraphClient.setAuthenticationProvider(testAuthProvider()) 22 | graphClient = MSGraphClient.defaultClient() 23 | 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | // check for creation of message 32 | func testCreateMailMessage() { 33 | 34 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main) 35 | let vc = storyboard.instantiateViewControllerWithIdentifier("SendViewController") as! SendViewController 36 | let message = vc.createSampleMessage(to: "test@samplemail") 37 | 38 | XCTAssertNotNil(message) 39 | } 40 | 41 | // check for getting user information: GET ME 42 | func testGetUserInformation() { 43 | let readyExpectation = expectation(description: "ready") 44 | graphClient.me().request().getWithCompletion({ (user: MSGraphUser?, error: NSError?) in 45 | XCTAssertNotNil(user, "User data should not be nil") 46 | XCTAssertNil(error, "Error should be nil") 47 | 48 | readyExpectation.fulfill() 49 | }) 50 | 51 | waitForExpectations(timeout: 10) { (error: NSError?) in 52 | XCTAssertNil(error, "Timeout") 53 | return 54 | } 55 | } 56 | 57 | 58 | // check sending mail 59 | func testSendingMail() { 60 | 61 | // get email address 62 | let path = Bundle(for: type(of: self)).path(forResource: "testUserArgs", ofType: "json") 63 | 64 | let jsonData = try! Data(contentsOf: URL(fileURLWithPath: path!), options: .mappedIfSafe) 65 | let jsonResult = try! JSONSerialization.jsonObject(with: jsonData, options: []) as! NSDictionary 66 | 67 | let username = jsonResult["test.username"] as! String 68 | XCTAssertNotNil(username, "username should not be nil") 69 | 70 | // get message 71 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main) 72 | let vc = storyboard.instantiateViewControllerWithIdentifier("SendViewController") as! SendViewController 73 | let message = vc.createSampleMessage(to: username) 74 | XCTAssertNotNil(message, "message should not be nil") 75 | 76 | // send mail 77 | let readyExpectation = expectation(description: "ready") 78 | 79 | graphClient.me().sendMailWithMessage(message, saveToSentItems: false).request().executeWithCompletion({ 80 | (response: [AnyHashable: Any]?, error: NSError?) in 81 | 82 | XCTAssertNotNil(response, "response should not be nil") 83 | XCTAssertNil(error, "Error should be nil") 84 | 85 | readyExpectation.fulfill() 86 | }) 87 | 88 | waitForExpectations(timeout: 10) { (error: NSError?) in 89 | XCTAssertNil(error, "Timeout") 90 | return 91 | } 92 | } 93 | } 94 | 95 | 96 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect.xcodeproj/xcshareddata/xcschemes/Graph-iOS-Swift-Connect.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /README-Localized/README-zh-cn.md: -------------------------------------------------------------------------------- 1 | # 适用于 iOS 的 Office 365 连接示例(使用 Microsoft Graph SDK) 2 | 3 | Microsoft Graph 是访问来自 Microsoft 云的数据、关系和数据解析的统一终结点。此示例介绍如何连接并对其进行身份验证,然后通过 [适用于 iOS 的 Microsoft Graph SDK](https://github.com/microsoftgraph/msgraph-sdk-ios) 调用邮件和用户 API。 4 | 5 | > 注意:尝试 [Microsoft Graph 应用注册门户](https://graph.microsoft.io/en-us/app-registration) 页,该页简化了注册,因此你可以更快地运行该示例。 6 | 7 | ## 先决条件 8 | * Apple 的 [Xcode](https://developer.apple.com/xcode/downloads/) - 此示例当前正在测试,并且在 Xcode 7.3.1 版本上受支持。 9 | * 安装 [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 作为依存关系管理器。 10 | * Microsoft 工作或个人电子邮件帐户,例如 Office 365 或 outlook.com、hotmail.com 等。你可以注册 [Office 365 开发人员订阅](https://aka.ms/devprogramsignup),其中包含开始构建 Office 365 应用所需的资源。 11 | 12 | > 注意:如果已有订阅,则之前的链接会将你转至包含以下信息的页面:*抱歉,你无法将其添加到当前帐户*。在这种情况下,请使用当前 Office 365 订阅中的帐户。 13 | * [Microsoft Graph 应用注册门户](https://graph.microsoft.io/en-us/app-registration) 中已注册应用的客户端 ID 14 | * 若要生成请求,必须提供 **MSAuthenticationProvider**(它能够使用适当的 OAuth 2.0 持有者令牌对 HTTPS 请求进行身份验证)。我们将使用 [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) 作为 MSAuthenticationProvider 的示例实现,它可用于快速启动你的项目。有关详细信息,请参阅下面的“**相关代码**”部分。 15 | 16 | 17 | ## 在 Xcode 中运行此示例 18 | 19 | 1. 克隆该存储库 20 | 2. 使用 CocoaPods 以导入 Microsoft Graph SDK 和身份验证依赖项: 21 | 22 | pod 'MSGraphSDK' 23 | pod 'MSGraphSDK-NXOAuth2Adapter' 24 | 25 | 26 | 该示例应用已包含可将 pod 导入到项目中的 pod 文件。只需从**终端**导航到项目并运行: 27 | 28 | pod install 29 | 30 | 更多详细信息,请参阅 [其他资源](#AdditionalResources) 中的“**使用 CocoaPods**” 31 | 32 | 3. 打开 **Graph-iOS-Swift-Connect.xcworkspace** 33 | 4. 在应用程序文件夹下打开 **AutheticationConstants.swift**。你会发现,注册过程的 **clientId** 可以被添加到该文件。 34 | 35 | ```swift 36 | static let clientId = "ENTER_YOUR_CLIENT_ID" 37 | ``` 38 | > 注意:你会注意到为该项目配置了以下权限范围:**https://graph.microsoft.com/Mail.Send”、“https://graph.microsoft.com/User.Read”、“offline_access”**。该项目中所使用的服务调用,向你的邮件帐户发送邮件并检索一些个人资料信息(显示名称、电子邮件地址)需要这些应用的权限以正常运行。 39 | 40 | 41 | 5. 运行示例。系统将要求你连接至工作或个人邮件帐户或对其进行身份验证,然后你可以向该帐户或其他所选电子邮件帐户发送邮件。 42 | 43 | 44 | ##相关代码 45 | 46 | 可以在 **Authentication.swift** 文件中查看所有身份验证代码。我们使用从 [NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) 扩展的 MSAuthenticationProvider 示例实现来提供对已注册的本机应用的登录支持、访问令牌的自动刷新和注销功能。 47 | ```swift 48 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 49 | 50 | if NXOAuth2AuthenticationProvider.sharedAuthProvider().loginSilent() == true { 51 | completion(error: nil) 52 | } 53 | else { 54 | NXOAuth2AuthenticationProvider.sharedAuthProvider() 55 | .loginWithViewController(nil) { (error: NSError?) in 56 | 57 | if let nserror = error { 58 | completion(error: MSGraphError.NSErrorType(error: nserror)) 59 | } 60 | else { 61 | completion(error: nil) 62 | } 63 | } 64 | } 65 | ... 66 | func disconnect() { 67 | NXOAuth2AuthenticationProvider.sharedAuthProvider().logout() 68 | } 69 | 70 | ``` 71 | 72 | 73 | 对身份验证提供程序进行设置后,我们可以创建并初始化客户端对象 (MSGraphClient),它将被用于对 Microsoft Graph 服务终结点(邮件和用户)进行调用。在 **SendMailViewcontroller.swift** 中,我们可以使用以下代码来组合邮件请求并将其发送: 74 | 75 | ```swift 76 | let requestBuilder = graphClient.me().sendMailWithMessage(message, saveToSentItems: false) 77 | let mailRequest = requestBuilder.request() 78 | 79 | mailRequest.executeWithCompletion({ 80 | (response: [NSObject : AnyObject]?, error: NSError?) in 81 | ... 82 | }) 83 | 84 | ``` 85 | 86 | 有关详细信息,包括调入其他服务(如 OneDrive)的代码,请参阅 [适用于 iOS 的 Microsoft Graph SDK](https://github.com/microsoftgraph/msgraph-sdk-ios) 87 | 88 | ## 问题和意见 89 | 90 | 我们乐意倾听你有关 Office 365 iOS Microsoft Graph Connect 项目的反馈。你可以在该存储库中的 [问题]() 部分将问题和建议发送给我们。 91 | 92 | 与 Office 365 开发相关的问题一般应发布到[Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API)。确保您的问题或意见使用了 [Office365] 和 [MicrosoftGraph] 标记。 93 | 94 | ## 参与 95 | 你需要在提交拉取请求之前签署 [参与者许可协议](https://cla.microsoft.com/)。要完成参与者许可协议 (CLA),你需要通过表格提交请求,并在收到包含文件链接的电子邮件时在 CLA 上提交电子签名。 96 | 97 | 此项目采用 [Microsoft 开源行为准则](https://opensource.microsoft.com/codeofconduct/)。有关详细信息,请参阅 [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)(行为准则常见问题解答),有任何其他问题或意见,也可联系 [opencode@microsoft.com](mailto:opencode@microsoft.com)。 98 | 99 | ## 其他资源 100 | 101 | * [Office 开发人员中心](http://dev.office.com/) 102 | * [Microsoft Graph 概述页](https://graph.microsoft.io) 103 | * [使用 CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 104 | 105 | ## 版权 106 | 版权所有 (c) 2016 Microsoft。保留所有权利。 107 | 108 | -------------------------------------------------------------------------------- /README-Localized/README-zh-tw.md: -------------------------------------------------------------------------------- 1 | # 使用 Microsoft Graph SDK 的 Office 365 Connect 範例 (適用於 iOS) 2 | 3 | Microsoft Graph 是存取資料的統一端點、來自 Microsoft 雲端的關係和見解。此範例示範如何連接和驗證,然後透過 [Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) 呼叫郵件和使用者 API。 4 | 5 | > 附註:嘗試可簡化註冊的 [Microsoft Graph 應用程式註冊入口網站](https://graph.microsoft.io/en-us/app-registration)頁面,以便您能更快速地執行這個範例。 6 | 7 | ## 必要條件 8 | * 來自 Apple 的 [Xcode](https://developer.apple.com/xcode/downloads/) - 此範例目前經過測試,可支援 Xcode 的版本 7.3.1。 9 | * 安裝 [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 做為相依性管理員。 10 | * Microsoft 工作或個人電子郵件帳戶,例如 Office 365,或 outlook.com、hotmail.com 等等。您可以註冊 [Office 365 開發人員訂用帳戶](https://aka.ms/devprogramsignup),其中包含開始建置 Office 365 應用程式所需的資源。 11 | 12 | > 附註:如果您已有訂用帳戶,則先前的連結會讓您連到顯示*抱歉,您無法將之新增到您目前的帳戶*訊息的頁面。在此情況下,請使用您目前的 Office 365 訂用帳戶所提供的帳戶。 13 | * 已註冊應用程式的用戶端識別碼,來自 [Microsoft Graph 應用程式註冊入口網站](https://graph.microsoft.io/en-us/app-registration) 14 | * 若要提出要求,必須提供 **MSAuthenticationProvider**,它能夠以適當的 OAuth 2.0 持有人權杖驗證 HTTPS 要求。我們會針對 MSAuthenticationProvider 的範例實作使用 [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter),可以用來幫助您的專案。請參閱以下區段**感興趣的程式碼**以取得詳細資訊。 15 | 16 | 17 | ## 在 Xcode 中執行這個範例 18 | 19 | 1. 複製此儲存機制 20 | 2. 使用 CocoaPods 來匯入 Microsoft Graph SDK 和驗證相依性: 21 | 22 | pod 'MSGraphSDK' 23 | pod 'MSGraphSDK-NXOAuth2Adapter' 24 | 25 | 26 | 此範例應用程式已經包含可將 pods 放入專案的 podfile。只需從 **Terminal** 瀏覽至專案並執行: 27 | 28 | pod install 29 | 30 | 如需詳細資訊,請參閱[其他資訊](#AdditionalResources)中的**使用 CocoaPods** 31 | 32 | 3. 開啟 **Graph-iOS-Swift-Connect.xcworkspace** 33 | 4. 開啟 [應用程式] 資料夾底下的 **AutheticationConstants.swift**。您會發現註冊程序的 **clientId** 可以新增至此檔案。 34 | 35 | ```swift 36 | static let clientId = "ENTER_YOUR_CLIENT_ID" 37 | ``` 38 | > 附註:您會注意到已針對此專案設定下列權限範圍:**"https://graph.microsoft.com/Mail.Send"、"https://graph.microsoft.com/User.Read"、"offline_access"**服務呼叫在此專案中使用,將郵件傳送至您的郵件帳戶並且擷取一些設定檔資訊 (顯示名稱、電子郵件地址) 需要這些權限才能讓應用程式適當地執行。 39 | 40 | 41 | 5. 執行範例。系統會要求您連接/驗證工作或個人郵件帳戶,然後您才可以將郵件傳送至該帳戶,或者傳送至其他選取的電子郵件帳戶。 42 | 43 | 44 | ##感興趣的程式碼 45 | 46 | 所有的驗證程式碼可以在 **Authentication.swift** 檔案中檢視。我們使用從 [NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) 延伸的 MSAuthenticationProvider 的範例實作,以提供已註冊原生應用程式的登入支援、自動重新整理存取權杖,以及登出功能: 47 | ```swift 48 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 49 | 50 | if NXOAuth2AuthenticationProvider.sharedAuthProvider().loginSilent() == true { 51 | completion(error: nil) 52 | } 53 | else { 54 | NXOAuth2AuthenticationProvider.sharedAuthProvider() 55 | .loginWithViewController(nil) { (error: NSError?) in 56 | 57 | if let nserror = error { 58 | completion(error: MSGraphError.NSErrorType(error: nserror)) 59 | } 60 | else { 61 | completion(error: nil) 62 | } 63 | } 64 | } 65 | ... 66 | func disconnect() { 67 | NXOAuth2AuthenticationProvider.sharedAuthProvider().logout() 68 | } 69 | 70 | ``` 71 | 72 | 73 | 一旦設定驗證提供者,我們可以建立和初始化用戶端物件 (MSGraphClient),用來針對 Microsoft Graph 服務端點 (郵件和使用者) 進行呼叫。在 **SendMailViewcontroller.swift** 中,我們可以使用下列程式碼組合郵件要求並且傳送它︰ 74 | 75 | ```swift 76 | let requestBuilder = graphClient.me().sendMailWithMessage(message, saveToSentItems: false) 77 | let mailRequest = requestBuilder.request() 78 | 79 | mailRequest.executeWithCompletion({ 80 | (response: [NSObject : AnyObject]?, error: NSError?) in 81 | ... 82 | }) 83 | 84 | ``` 85 | 86 | 如需詳細資訊,包括用來呼叫至其他服務 (像是 OneDrive) 的程式碼,請參閱 [Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) 87 | 88 | ## 問題和建議 89 | 90 | 我們很樂於收到您對於 Office 365 iOS Microsoft Graph Connect 專案的意見反應。您可以在此儲存機制的[問題]()區段中,將您的問題及建議傳送給我們。 91 | 92 | 請在 [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API) 提出有關 Office 365 開發的一般問題。務必以 [Office365] 和 [MicrosoftGraph] 標記您的問題或意見。 93 | 94 | ## 參與 95 | 您必須在提交您的提取要求之前,先簽署[投稿者授權合約](https://cla.microsoft.com/)。若要完成投稿者授權合約 (CLA),您必須透過表單提交要求,然後在您收到含有文件連結的電子郵件時以電子方式簽署 CLA。 96 | 97 | 此專案已採用 [Microsoft 開放原始碼執行](https://opensource.microsoft.com/codeofconduct/)。如需詳細資訊,請參閱[程式碼執行常見問題集](https://opensource.microsoft.com/codeofconduct/faq/),如果有其他問題或意見,請連絡 [opencode@microsoft.com](mailto:opencode@microsoft.com)。 98 | 99 | ## 其他資源 100 | 101 | * [Office 開發人員中心](http://dev.office.com/) 102 | * [Microsoft Graph 概觀頁面](https://graph.microsoft.io) 103 | * [使用 CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 104 | 105 | ## 著作權 106 | Copyright (c) 2016 Microsoft.著作權所有,並保留一切權利。 107 | 108 | -------------------------------------------------------------------------------- /README-Localized/README-ja-jp.md: -------------------------------------------------------------------------------- 1 | # Microsoft Graph SDK を使用した iOS 用 Office 365 Connect サンプル 2 | 3 | Microsoft Graph は、Microsoft Cloud からのデータ、リレーションシップおよびインサイトにアクセスするための統合エンドポイントです。このサンプルでは、これに接続して認証し、[Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) 経由でメールとユーザーの API を呼び出す方法を示します。 4 | 5 | > 注:このサンプルをより迅速に実行するため、登録手順が簡略化された「[Microsoft Graph アプリ登録ポータル](https://graph.microsoft.io/en-us/app-registration)」ページをお試しください。 6 | 7 | ## 前提条件 8 | * Apple 社の [Xcode](https://developer.apple.com/xcode/downloads/) - 現在このサンプルがテストされ、Xcode のバージョン 7.3.1 でサポートされています。 9 | * 依存関係マネージャーとしての [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) のインストール。 10 | * Office 365、outlook.com、hotmail.com などの、Microsoft の職場または個人用のメール アカウント。Office 365 アプリのビルドを開始するために必要なリソースを含む、[Office 365 Developer サブスクリプション](https://aka.ms/devprogramsignup)にサインアップできます。 11 | 12 | > 注:サブスクリプションをすでにお持ちの場合、上記のリンクをクリックすると、「*申し訳ございません。現在のアカウントに追加できません*」というメッセージが表示されるページに移動します。その場合は、現在使用している Office 365 サブスクリプションのアカウントをご利用いただけます。 13 | * [Microsoft Graph アプリ登録ポータル](https://graph.microsoft.io/en-us/app-registration) で登録済みのアプリのクライアント ID 14 | * 要求を実行するには、適切な OAuth 2.0 ベアラー トークンを使用して HTTPS 要求を認証できる **MSAuthenticationProvider** を指定する必要があります。プロジェクトのジャンプ スタート用に使用できる MSAuthenticationProvider をサンプル実装するために、[msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) を使用します。詳細については、以下の「**目的のコード**」セクションをご覧ください。 15 | 16 | 17 | ## Xcode でこのサンプルを実行する 18 | 19 | 1. このリポジトリの複製を作成する 20 | 2. CocoaPods を使用して、Microsoft Graph SDK と認証の依存関係をインポートします: 21 | 22 | pod 'MSGraphSDK' 23 | pod 'MSGraphSDK-NXOAuth2Adapter' 24 | 25 | 26 | このサンプル アプリには、プロジェクトに pod を取り込む podfile が既に含まれています。**ターミナル**からプロジェクトに移動して次を実行するだけです: 27 | 28 | pod install 29 | 30 | 詳細については、[その他の技術情報](#AdditionalResources)の「**CocoaPods を使う**」を参照してください 31 | 32 | 3. **Graph-iOS-Swift-Connect.xcworkspace** を開きます 33 | 4. アプリケーション フォルダーで、**AutheticationConstants.swift** を開きます。登録プロセスの **clientId** がこのファイルに追加されていることが分かります。 34 | 35 | ```swift 36 | static let clientId = "ENTER_YOUR_CLIENT_ID" 37 | ``` 38 | > 注:次のアクセス許可の適用範囲がこのプロジェクトに対して構成されていることが分かります。: **"https://graph.microsoft.com/Mail.Send"、"https://graph.microsoft.com/User.Read"、"offline_access"**。このプロジェクトで使用されるサービス呼び出し、メール アカウントへのメールの送信、および一部のプロファイル情報 (表示名、メール アドレス) の取得では、アプリが適切に実行するためにこれらのアクセス許可が必要です。 39 | 40 | 41 | 5. サンプルを実行します。職場または個人用のメール アカウントに接続または認証するように求められ、そのアカウントか、別の選択したメール アカウントにメールを送信することができます。 42 | 43 | 44 | ##目的のコード 45 | 46 | すべての認証コードは、**Authentication.swift** ファイルで確認することができます。[NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) から拡張された MSAuthenticationProvider のサンプル実装を使用して、登録済みのネイティブ アプリのログインのサポート、アクセス トークンの自動更新、およびログアウト機能を提供します: 47 | ```swift 48 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 49 | 50 | if NXOAuth2AuthenticationProvider.sharedAuthProvider().loginSilent() == true { 51 | completion(error: nil) 52 | } 53 | else { 54 | NXOAuth2AuthenticationProvider.sharedAuthProvider() 55 | .loginWithViewController(nil) { (error: NSError?) in 56 | 57 | if let nserror = error { 58 | completion(error: MSGraphError.NSErrorType(error: nserror)) 59 | } 60 | else { 61 | completion(error: nil) 62 | } 63 | } 64 | } 65 | ... 66 | func disconnect() { 67 | NXOAuth2AuthenticationProvider.sharedAuthProvider().logout() 68 | } 69 | 70 | ``` 71 | 72 | 73 | 認証プロバイダーを設定すると、Microsoft Graph サービス エンドポイント (メールとユーザー) に対して呼び出しを実行するために使用されるクライアント オブジェクト (MSGraphClient) の作成と初期化が行えます。**SendMailViewcontroller.swift** では、次のコードを使用して、メール要求をアセンブルし、送信できます: 74 | 75 | ```swift 76 | let requestBuilder = graphClient.me().sendMailWithMessage(message, saveToSentItems: false) 77 | let mailRequest = requestBuilder.request() 78 | 79 | mailRequest.executeWithCompletion({ 80 | (response: [NSObject : AnyObject]?, error: NSError?) in 81 | ... 82 | }) 83 | 84 | ``` 85 | 86 | OneDrive のような他のサービスへの呼び出しを行うコードなどの詳細については、「[Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios)」を参照してください 87 | 88 | ## 質問とコメント 89 | 90 | Office 365 iOS Microsoft Graph Connect プロジェクトに関するフィードバックをお寄せください。質問や提案につきましては、このリポジトリの「[問題]()」セクションで送信できます。 91 | 92 | Office 365 開発全般の質問につきましては、「[Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API)」に投稿してください。質問またはコメントには、必ず [Office365] および [MicrosoftGraph] のタグを付けてください。 93 | 94 | ## 投稿 95 | プル要求を送信する前に、[投稿者のライセンス契約](https://cla.microsoft.com/)に署名する必要があります。投稿者のライセンス契約 (CLA) を完了するには、ドキュメントへのリンクを含むメールを受信した際に、フォームから要求を送信し、CLA に電子的に署名する必要があります。 96 | 97 | このプロジェクトでは、[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) が採用されています。詳細については、「[規範に関する FAQ](https://opensource.microsoft.com/codeofconduct/faq/)」を参照してください。または、その他の質問やコメントがあれば、[opencode@microsoft.com](mailto:opencode@microsoft.com) までにお問い合わせください。 98 | 99 | ## 追加リソース 100 | 101 | * [Office デベロッパー センター](http://dev.office.com/) 102 | * [Microsoft Graph の概要ページ](https://graph.microsoft.io) 103 | * [CocoaPods を使う](https://guides.cocoapods.org/using/using-cocoapods.html) 104 | 105 | ## 著作権 106 | Copyright (c) 2016 Microsoft.All rights reserved. 107 | 108 | -------------------------------------------------------------------------------- /README-Localized/README-ru-ru.md: -------------------------------------------------------------------------------- 1 | # Приложение Office 365 Connect для iOS, использующее Microsoft Graph SDK 2 | 3 | Microsoft Graph — единая конечная точка для доступа к данным, отношениям и статистике из Microsoft Cloud. В этом примере показано, как подключиться к ней и пройти проверку подлинности, а затем вызывать почтовые и пользовательские API через [Microsoft Graph SDK для iOS](https://github.com/microsoftgraph/msgraph-sdk-ios). 4 | 5 | > Примечание. Воспользуйтесь упрощенной регистрацией на [портале регистрации приложений Microsoft Graph](https://graph.microsoft.io/en-us/app-registration), чтобы ускорить запуск этого примера. 6 | 7 | ## Необходимые компоненты 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) от Apple. Этот пример в настоящее время проверяется и поддерживается в Xcode версии 7.3.1. 9 | * Установка [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) в качестве диспетчера зависимостей. 10 | * Рабочая или личная учетная запись Майкрософт, например Office 365, outlook.com или hotmail.com. Вы можете [подписаться на план Office 365 для разработчиков](https://aka.ms/devprogramsignup), который включает ресурсы, необходимые для создания приложений Office 365. 11 | 12 | > Примечание. Если у вас уже есть подписка, при выборе приведенной выше ссылки откроется страница с сообщением *К сожалению, вы не можете добавить это к своей учетной записи*. В этом случае используйте учетную запись, связанную с текущей подпиской на Office 365. 13 | * Идентификатор клиента из приложения, зарегистрированного на [портале регистрации приложений Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 14 | * Чтобы отправлять запросы, необходимо указать протокол **MSAuthenticationProvider**, который способен проверять подлинность HTTPS-запросов с помощью соответствующего маркера носителя OAuth 2.0. Для реализации протокола MSAuthenticationProvider и быстрого запуска проекта мы будем использовать [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter). Дополнительные сведения см. в разделе **Полезный код**. 15 | 16 | 17 | ## Запуск этого примера в Xcode 18 | 19 | 1. Клонируйте этот репозиторий. 20 | 2. Импортируйте зависимости пакета SDK Microsoft Graph и проверки подлинности с помощью CocoaPods: 21 | 22 | pod 'MSGraphSDK' 23 | pod 'MSGraphSDK-NXOAuth2Adapter' 24 | 25 | 26 | Этот пример приложения уже содержит podfile, который добавит компоненты pod в проект. Просто перейдите к проекту из раздела **Терминал** и выполните следующую команду: 27 | 28 | pod install 29 | 30 | Для получения дополнительных сведений выберите ссылку **Использование CocoaPods** в разделе [Дополнительные ресурсы](#AdditionalResources). 31 | 32 | 3. Откройте **Graph-iOS-Swift-Connect.xcworkspace**. 33 | 4. Откройте **AutheticationConstants.swift** в папке "Приложение". Вы увидите, что в этот файл можно добавить идентификатор клиента **clientId**, скопированный в ходе регистрации. 34 | 35 | ```swift 36 | static let clientId = "ENTER_YOUR_CLIENT_ID" 37 | ``` 38 | > Примечание. Вы заметите, что для этого проекта настроены следующие разрешения: **"https://graph.microsoft.com/Mail.Send", "https://graph.microsoft.com/User.Read", "offline_access"**. Эти разрешения необходимы для правильной работы приложения, в частности отправки сообщения в учетную запись почты и получения сведений профиля (отображаемое имя, адрес электронной почты). 39 | 40 | 41 | 5. Запустите приложение. Вам будет предложено подключить рабочую или личную учетную запись почты и войти в нее, после чего вы сможете отправить сообщение в эту или другую учетную запись. 42 | 43 | 44 | ##Полезный код 45 | 46 | Весь код для проверки подлинности можно найти в файле **Authentication.swift**. Мы используем протокол MSAuthenticationProvider из файла [NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) для поддержки входа в зарегистрированных собственных приложениях, автоматического обновления маркеров доступа и выхода: 47 | ```swift 48 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 49 | 50 | if NXOAuth2AuthenticationProvider.sharedAuthProvider().loginSilent() == true { 51 | completion(error: nil) 52 | } 53 | else { 54 | NXOAuth2AuthenticationProvider.sharedAuthProvider() 55 | .loginWithViewController(nil) { (error: NSError?) in 56 | 57 | if let nserror = error { 58 | completion(error: MSGraphError.NSErrorType(error: nserror)) 59 | } 60 | else { 61 | completion(error: nil) 62 | } 63 | } 64 | } 65 | ... 66 | func disconnect() { 67 | NXOAuth2AuthenticationProvider.sharedAuthProvider().logout() 68 | } 69 | 70 | ``` 71 | 72 | 73 | Если поставщик проверки подлинности настроен, мы можем создать и инициализировать объект клиента (MSGraphClient), который будет использоваться для вызова службы Microsoft Graph (почта и пользователи). Мы можем собрать почтовый запрос в **SendMailViewcontroller.swift** и отправить его с помощью следующего кода: 74 | 75 | ```swift 76 | let requestBuilder = graphClient.me().sendMailWithMessage(message, saveToSentItems: false) 77 | let mailRequest = requestBuilder.request() 78 | 79 | mailRequest.executeWithCompletion({ 80 | (response: [NSObject : AnyObject]?, error: NSError?) in 81 | ... 82 | }) 83 | 84 | ``` 85 | 86 | Дополнительные сведения, в том числе код для вызова других служб, например OneDrive, см. в статье [Microsoft Graph SDK для iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) 87 | 88 | ## Вопросы и комментарии 89 | 90 | Мы будем рады узнать ваше мнение о проекте Office 365 Connect для iOS, использующем Microsoft Graph. Вы можете отправлять нам вопросы и предложения на вкладке [Issues]() этого репозитория. 91 | 92 | Общие вопросы о разработке решений для Office 365 следует публиковать на сайте [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Обязательно помечайте свои вопросы и комментарии тегами [Office365] и [MicrosoftGraph]. 93 | 94 | ## Добавление кода 95 | Прежде чем отправить запрос на включение внесенных изменений, необходимо подписать [лицензионное соглашение с участником](https://cla.microsoft.com/). Чтобы заполнить лицензионное соглашение с участником (CLA), вам потребуется отправить запрос с помощью формы, а затем после получения электронного сообщения со ссылкой на этот документ подписать CLA с помощью электронной подписи. 96 | 97 | Этот проект соответствует [правилам поведения Майкрософт, касающимся обращения с открытым кодом](https://opensource.microsoft.com/codeofconduct/). Читайте дополнительные сведения в [разделе вопросов и ответов по правилам поведения](https://opensource.microsoft.com/codeofconduct/faq/) или отправляйте новые вопросы и замечания по адресу [opencode@microsoft.com](mailto:opencode@microsoft.com). 98 | 99 | ## Дополнительные ресурсы 100 | 101 | * [Центр разработки для Office](http://dev.office.com/) 102 | * [Страница с общими сведениями о Microsoft Graph](https://graph.microsoft.io) 103 | * [Использование CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 104 | 105 | ## Авторское право 106 | (c) Корпорация Майкрософт (Microsoft Corporation), 2016. Все права защищены. 107 | 108 | -------------------------------------------------------------------------------- /README-Localized/README-pt-br.md: -------------------------------------------------------------------------------- 1 | # Exemplo de conexão com o Office 365 para iOS usando o SDK do Microsoft Graph 2 | 3 | O Microsoft Graph é um ponto de extremidade unificado para acessar dados, relações e ideias que vêm do Microsoft Cloud. Este exemplo mostra como realizar a conexão e a autenticação no Microsoft Graph e, em seguida, chamar APIs de mala direta e usuário por meio do [SDK do Microsoft Graph para iOS](https://github.com/microsoftgraph/msgraph-sdk-ios). 4 | 5 | > Observação: Experimente a página [Portal de Registro de Aplicativos do Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) que simplifica o registro para que você possa executar este exemplo com mais rapidez. 6 | 7 | ## Pré-requisitos 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) da Apple – Atualmente, este exemplo é compatível e testado na versão 7.3.1 do Xcode. 9 | * Instalação do [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) como um gerente de dependências. 10 | * Uma conta de email comercial ou pessoal da Microsoft como o Office 365, ou outlook.com, hotmail.com, etc. Inscreva-se em uma [Assinatura do Office 365 para Desenvolvedor](https://aka.ms/devprogramsignup) que inclua os recursos necessários para começar a criar aplicativos do Office 365. 11 | 12 | > Observação: Caso já tenha uma assinatura, o link anterior direciona você para uma página com a mensagem *Não é possível adicioná-la à sua conta atual*. Nesse caso, use uma conta de sua assinatura atual do Office 365. 13 | * Uma ID de cliente do aplicativo registrado no [Portal de Registro de Aplicativos do Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 14 | * Para realizar solicitações de autenticação, um **MSAuthenticationProvider** deve ser fornecido para autenticar solicitações HTTPS com um token de portador OAuth 2.0 apropriado. Usaremos [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) para uma implementação de exemplo de MSAuthenticationProvider que pode ser usado para iniciar rapidamente o projeto. Para saber mais, confira a seção abaixo **Código de Interesse** 15 | 16 | 17 | ## Executando este exemplo em Xcode 18 | 19 | 1. Clonar este repositório 20 | 2. Use o CocoaPods para importar as dependências de autenticação e o SDK do Microsoft Graph: 21 | 22 | pod 'MSGraphSDK' 23 | pod 'MSGraphSDK-NXOAuth2Adapter' 24 | 25 | 26 | Este aplicativo de exemplo já contém um podfile que colocará os pods no projeto. Simplesmente navegue até o projeto do **Terminal** e execute: 27 | 28 | pod install 29 | 30 | Para saber mais, confira o artigo **Usar o CocoaPods** em [Recursos Adicionais](#AdditionalResources) 31 | 32 | 3. Abrir **Graph-iOS-Swift-Connect.xcworkspace** 33 | 4. Abra **AutheticationConstants.swift** na pasta Aplicativo. Observe que você pode adicionar o valor de **clientId** ao arquivo do processo de registro. 34 | 35 | ```swift 36 | static let clientId = "ENTER_YOUR_CLIENT_ID" 37 | ``` 38 | > Observação: Você notará que foram configurados os seguintes escopos de permissão para esse projeto: **"https://graph.microsoft.com/Mail.Send", "https://graph.microsoft.com/User.Read", "offline_access"**. As chamadas de serviço usadas neste projeto, ao enviar um email para sua conta de email e ao recuperar algumas informações de perfil (Nome de Exibição, Endereço de Email), exigem essas permissões para que o aplicativo seja executado corretamente. 39 | 40 | 41 | 5. Execute o exemplo. Você será solicitado a conectar/autenticar uma conta de email comercial ou pessoal e, em seguida, poderá enviar um email a essa conta ou a outra conta de email selecionada. 42 | 43 | 44 | ##Código de Interesse 45 | 46 | Todo código de autenticação pode ser visualizado no arquivo **Authentication.swift**. Usamos um exemplo de implementação do MSAuthenticationProvider estendida do [NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) para fornecer suporte de logon a aplicativos nativos registrados, atualização automática de tokens de acesso e recursos de logoff: 47 | ```swift 48 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 49 | 50 | if NXOAuth2AuthenticationProvider.sharedAuthProvider().loginSilent() == true { 51 | completion(error: nil) 52 | } 53 | else { 54 | NXOAuth2AuthenticationProvider.sharedAuthProvider() 55 | .loginWithViewController(nil) { (error: NSError?) in 56 | 57 | if let nserror = error { 58 | completion(error: MSGraphError.NSErrorType(error: nserror)) 59 | } 60 | else { 61 | completion(error: nil) 62 | } 63 | } 64 | } 65 | ... 66 | func disconnect() { 67 | NXOAuth2AuthenticationProvider.sharedAuthProvider().logout() 68 | } 69 | 70 | ``` 71 | 72 | 73 | Depois que o provedor de autenticação estiver definido, podemos criar e inicializar um objeto de cliente (MSGraphClient) que será usado para fazer chamadas no ponto de extremidade do serviço do Microsoft Graph (email e usuários). Em **SendMailViewcontroller.swift**, podemos montar uma solicitação de email e enviá-la usando o seguinte código: 74 | 75 | ```swift 76 | let requestBuilder = graphClient.me().sendMailWithMessage(message, saveToSentItems: false) 77 | let mailRequest = requestBuilder.request() 78 | 79 | mailRequest.executeWithCompletion({ 80 | (response: [NSObject : AnyObject]?, error: NSError?) in 81 | ... 82 | }) 83 | 84 | ``` 85 | 86 | Para obter mais informações, incluindo código para chamar outros serviços, como o OneDrive, confira o [SDK do Microsoft Graph para iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) 87 | 88 | ## Perguntas e comentários 89 | 90 | Gostaríamos de saber sua opinião sobre o projeto de conexão com o Office 365 para iOS usando o Microsoft Graph. Você pode nos enviar suas perguntas e sugestões por meio da seção [Issues]() deste repositório. 91 | 92 | As perguntas sobre o desenvolvimento do Office 365 em geral devem ser postadas no [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Não deixe de marcar as perguntas ou comentários com [Office365] e [MicrosoftGraph]. 93 | 94 | ## Colaboração 95 | Será preciso assinar um [Contributor License Agreement (Contrato de Licença de Colaborador)](https://cla.microsoft.com/) antes de enviar a solicitação pull. Para concluir o CLA (Contributor License Agreement), você deve enviar uma solicitação através do formulário e assinar eletronicamente o CLA quando receber o email com o link para o documento. 96 | 97 | Este projeto adotou o [Código de Conduta do Código Aberto da Microsoft](https://opensource.microsoft.com/codeofconduct/). Para saber mais, confira as [Perguntas frequentes do Código de Conduta](https://opensource.microsoft.com/codeofconduct/faq/) ou contate [opencode@microsoft.com](mailto:opencode@microsoft.com) se tiver outras dúvidas ou comentários. 98 | 99 | ## Recursos adicionais 100 | 101 | * [Centro de Desenvolvimento do Office](http://dev.office.com/) 102 | * [Página de visão geral do Microsoft Graph](https://graph.microsoft.io) 103 | * [Usando o CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 104 | 105 | ## Direitos autorais 106 | Copyright © 2016 Microsoft. Todos os direitos reservados. 107 | 108 | -------------------------------------------------------------------------------- /README-Localized/README-es-es.md: -------------------------------------------------------------------------------- 1 | # Ejemplo Connect de Office 365 para iOS con SDK de Microsoft Graph 2 | 3 | Microsoft Graph es un punto de conexión unificado para acceder a los datos, las relaciones y datos que proceden de Microsoft Cloud. Este ejemplo muestra cómo conectarse, autenticarse y, después, llamar a la API de usuario y correo a través del [SDK de Microsoft Graph para iOS](https://github.com/microsoftgraph/msgraph-sdk-ios). 4 | 5 | > Nota: Consulte la página del [Portal de registro de la aplicación de Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) que simplifica el registro para poder conseguir que este ejemplo se ejecute más rápidamente. 6 | 7 | ## Requisitos previos 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) de Apple: este ejemplo ya se ha probado y es compatible con la versión 7.3.1 de Xcode. 9 | * Instale [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) como administrador de dependencias. 10 | * Una cuenta de correo electrónico personal o profesional de Microsoft como Office 365, outlook.com, hotmail.com, etc. Puede registrarse para [una suscripción de Office 365 Developer](https://aka.ms/devprogramsignup), que incluye los recursos que necesita para comenzar a crear aplicaciones de Office 365. 11 | 12 | > Nota: Si ya dispone de una suscripción, el vínculo anterior le dirige a una página con el mensaje *No se puede agregar a su cuenta actual*. En ese caso, use una cuenta de su suscripción actual a Office 365. 13 | * Un Id. de cliente de la aplicación registrada en el [Portal de registro de la aplicación de Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 14 | * Para realizar solicitudes, se debe proporcionar un **MSAuthenticationProvider** que sea capaz de autenticar solicitudes HTTPS con un token de portador OAuth 2.0 adecuado. Usaremos [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) para una implementación de MSAuthenticationProvider que puede usarse para poner en marcha el proyecto. Consulte la sección **Código de interés** para obtener más información. 15 | 16 | 17 | ## Ejecutar este ejemplo en Xcode 18 | 19 | 1. Clone este repositorio. 20 | 2. Use CocoaPods para importar el SDK de Microsoft Graph y las dependencias de autenticación: 21 | 22 | pod 'MSGraphSDK' 23 | pod 'MSGraphSDK-NXOAuth2Adapter' 24 | 25 | 26 | Esta aplicación de ejemplo ya contiene un podfile que recibirá los pods en el proyecto. Simplemente vaya al proyecto desde **Terminal** y ejecute: 27 | 28 | pod install 29 | 30 | Para obtener más información, consulte **Usar CocoaPods** en [Recursos adicionales](#AdditionalResources) 31 | 32 | 3. Abra **Graph-iOS-Swift-Connect.xcworkspace** 33 | 4. Abra **AutheticationConstants.swift** en la carpeta Application. Verá que el **clientID** del proceso de registro se puede agregar a este archivo. 34 | 35 | ```swift 36 | static let clientId = "ENTER_YOUR_CLIENT_ID" 37 | ``` 38 | > Nota: Observará que se han configurado los siguientes ámbitos de permiso para este proyecto: **"https://graph.microsoft.com/Mail.Send", "https://graph.microsoft.com/User.Read", "offline_access"**. Las llamadas al servicio usadas en este proyecto, el envío de un correo a su cuenta de correo y la recuperación de la información de perfil (nombre para mostrar, dirección de correo electrónico) requieren estos permisos para que la aplicación se ejecute correctamente. 39 | 40 | 41 | 5. Ejecute el ejemplo. Deberá conectarse a una cuenta de correo personal o profesional, o autenticarlas, y, después, puede enviar un correo a esa cuenta, o a otra cuenta de correo electrónico seleccionada. 42 | 43 | 44 | ##Código de interés 45 | 46 | Todos los códigos de autenticación que se pueden ver en el archivo **Authentication.swift**. Usamos una implementación de ejemplo de MSAuthenticationProvider de [NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) para proporcionar compatibilidad de inicio de sesión a aplicaciones nativas registradas, actualización automática de los tokens de acceso y la característica de cierre de sesión: 47 | ```swift 48 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 49 | 50 | if NXOAuth2AuthenticationProvider.sharedAuthProvider().loginSilent() == true { 51 | completion(error: nil) 52 | } 53 | else { 54 | NXOAuth2AuthenticationProvider.sharedAuthProvider() 55 | .loginWithViewController(nil) { (error: NSError?) in 56 | 57 | if let nserror = error { 58 | completion(error: MSGraphError.NSErrorType(error: nserror)) 59 | } 60 | else { 61 | completion(error: nil) 62 | } 63 | } 64 | } 65 | ... 66 | func disconnect() { 67 | NXOAuth2AuthenticationProvider.sharedAuthProvider().logout() 68 | } 69 | 70 | ``` 71 | 72 | 73 | Una vez se defina el proveedor de autenticación, podemos crear e inicializar un objeto de cliente (MSGraphClient) que se usará para realizar llamadas en el punto de conexión de servicio de Microsoft Graph (correo y usuarios). En **SendMailViewcontroller.swift** podemos ensamblar una solicitud de correo y enviarla mediante el código siguiente: 74 | 75 | ```swift 76 | let requestBuilder = graphClient.me().sendMailWithMessage(message, saveToSentItems: false) 77 | let mailRequest = requestBuilder.request() 78 | 79 | mailRequest.executeWithCompletion({ 80 | (response: [NSObject : AnyObject]?, error: NSError?) in 81 | ... 82 | }) 83 | 84 | ``` 85 | 86 | Para obtener más información, incluido el código para llamar a otros servicios, como OneDrive, consulte el [GDK de Microsoft Graph para iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) 87 | 88 | ## Preguntas y comentarios 89 | 90 | Nos encantaría recibir sus comentarios sobre el proyecto Connect de Office 365 para iOS con Microsoft Graph. Puede enviarnos sus preguntas y sugerencias a través de la sección [Problemas]() de este repositorio. 91 | 92 | Las preguntas generales sobre desarrollo en Office 365 deben publicarse en [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Asegúrese de que sus preguntas o comentarios se etiquetan con [Office365] y [MicrosoftGraph]. 93 | 94 | ## Colaboradores 95 | Deberá firmar un [Contrato de licencia de colaborador](https://cla.microsoft.com/) antes de enviar la solicitud de incorporación de cambios. Para completar el Contrato de licencia de colaborador (CLA), deberá enviar una solicitud mediante el formulario y, después, firmar electrónicamente el CLA cuando reciba el correo electrónico que contiene el vínculo al documento. 96 | 97 | Este proyecto ha adoptado el [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) (Código de conducta de código abierto de Microsoft). Para obtener más información, consulte las [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) (Preguntas más frecuentes del código de conducta) o póngase en contacto con [opencode@microsoft.com](mailto:opencode@microsoft.com) con otras preguntas o comentarios. 98 | 99 | ## Recursos adicionales 100 | 101 | * [Centro de desarrollo de Office](http://dev.office.com/) 102 | * [Página de información general de Microsoft Graph](https://graph.microsoft.io) 103 | * [Usar CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 104 | 105 | ## Copyright 106 | Copyright (c) 2016 Microsoft. Todos los derechos reservados. 107 | 108 | -------------------------------------------------------------------------------- /README-Localized/README-fr-fr.md: -------------------------------------------------------------------------------- 1 | # Exemple de connexion d’Office 365 pour iOS avec le kit de développement logiciel Microsoft Graph 2 | 3 | Microsoft Graph est un point de terminaison unifié pour accéder aux données, aux relations et aux connaissances fournies à partir du cloud Microsoft. Cet exemple montre comment se connecter et s’authentifier, puis appeler les API de messagerie et utilisateur via le [kit de développement logiciel Microsoft Graph pour iOS](https://github.com/microsoftgraph/msgraph-sdk-ios). 4 | 5 | > Remarque : Consultez la page relative au [portail d’inscription de l’application Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) pour enregistrer plus facilement votre application et exécuter plus rapidement cet exemple. 6 | 7 | ## Conditions préalables 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) d’Apple - Cet exemple est actuellement testé et pris en charge sous la version 7.3.1 de Xcode. 9 | * Installation de [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) comme gestionnaire de dépendances. 10 | * Un compte de messagerie professionnel ou personnel Microsoft comme Office 365 ou outlook.com, hotmail.com, etc. Vous pouvez vous inscrire à [Office 365 Developer](https://aka.ms/devprogramsignup) pour accéder aux ressources dont vous avez besoin afin de commencer à créer des applications Office 365. 11 | 12 | > Remarque : Si vous avez déjà un abonnement, le lien précédent vous renvoie vers une page avec le message suivant : *Désolé, vous ne pouvez pas ajouter ceci à votre compte existant*. Dans ce cas, utilisez un compte lié à votre abonnement Office 365 existant. 13 | * Un ID client de l’application enregistrée auprès du [portail d’inscription de l’application Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 14 | * Pour effectuer des requêtes, vous devez fournir un élément **MSAuthenticationProvider** capable d’authentifier les requêtes HTTPS avec un jeton de support OAuth 2.0 approprié. Nous allons utiliser [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) pour un exemple d’implémentation de MSAuthenticationProvider qui peut être utilisé pour commencer rapidement votre projet. Voir la section **Code d’intérêt** ci-dessous pour plus d’informations. 15 | 16 | 17 | ## Exécution de cet exemple dans Xcode 18 | 19 | 1. Cloner ce référentiel 20 | 2. Utilisez CocoaPods pour importer les dépendances d’authentification et le kit de développement logiciel Microsoft Graph : 21 | 22 | pod 'MSGraphSDK' 23 | pod 'MSGraphSDK-NXOAuth2Adapter' 24 | 25 | 26 | Cet exemple d’application contient déjà un podfile qui recevra les pods dans le projet. Ouvrez simplement le projet à partir de **Terminal** et exécutez : 27 | 28 | pod install 29 | 30 | Pour plus d’informations, consultez **Utilisation de CocoaPods** dans [Ressources supplémentaires](#AdditionalResources). 31 | 32 | 3. Ouvrez **Graph-iOS-Swift-Connect.xcworkspace**. 33 | 4. Ouvrez **AutheticationConstants.swift** sous le dossier Application. Vous verrez que l’**ID client** du processus d’inscription peut être ajouté à ce fichier. 34 | 35 | ```swift 36 | static let clientId = "ENTER_YOUR_CLIENT_ID" 37 | ``` 38 | > Remarque : Vous remarquerez que les étendues d’autorisations suivantes ont été configurées pour ce projet : **« https://graph.microsoft.com/Mail.Send », « https://graph.microsoft.com/User.Read », « offline_access »**. Les appels de service utilisés dans ce projet, l’envoi d’un courrier électronique à votre compte de messagerie et la récupération des informations de profil (nom d’affichage, adresse e-mail) ont besoin de ces autorisations pour que l’application s’exécute correctement. 39 | 40 | 41 | 5. Exécutez l’exemple. Vous êtes invité à vous connecter/authentifier à un compte de messagerie personnel ou professionnel, puis vous pouvez envoyer un message à ce compte ou à un autre compte de messagerie sélectionné. 42 | 43 | 44 | ##Code d’intérêt 45 | 46 | Tout le code d’authentification peut être affiché dans le fichier **Authentication.swift**. Nous utilisons un exemple d’implémentation de MSAuthenticationProvider étendu de [NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) pour prendre en charge la connexion des applications natives inscrites, l’actualisation automatique des jetons d’accès et la fonctionnalité de déconnexion : 47 | ```swift 48 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 49 | 50 | if NXOAuth2AuthenticationProvider.sharedAuthProvider().loginSilent() == true { 51 | completion(error: nil) 52 | } 53 | else { 54 | NXOAuth2AuthenticationProvider.sharedAuthProvider() 55 | .loginWithViewController(nil) { (error: NSError?) in 56 | 57 | if let nserror = error { 58 | completion(error: MSGraphError.NSErrorType(error: nserror)) 59 | } 60 | else { 61 | completion(error: nil) 62 | } 63 | } 64 | } 65 | ... 66 | func disconnect() { 67 | NXOAuth2AuthenticationProvider.sharedAuthProvider().logout() 68 | } 69 | 70 | ``` 71 | 72 | 73 | Une fois le fournisseur d’authentification défini, nous pouvons créer et initialiser un objet client (MSGraphClient) qui sert à effectuer des appels par rapport au point de terminaison du service Microsoft Graph (courrier et utilisateurs). Dans **SendMailViewcontroller.swift**, nous pouvons assembler une requête de messagerie et l’envoyer en utilisant le code suivant : 74 | 75 | ```swift 76 | let requestBuilder = graphClient.me().sendMailWithMessage(message, saveToSentItems: false) 77 | let mailRequest = requestBuilder.request() 78 | 79 | mailRequest.executeWithCompletion({ 80 | (response: [NSObject : AnyObject]?, error: NSError?) in 81 | ... 82 | }) 83 | 84 | ``` 85 | 86 | Pour plus d’informations, y compris le code d’appel à d’autres services, tels que OneDrive, voir la section [Kit de développement logiciel Microsoft Graph pour iOS](https://github.com/microsoftgraph/msgraph-sdk-ios). 87 | 88 | ## Questions et commentaires 89 | 90 | Nous serions ravis de connaître votre opinion sur le projet de connexion d’iOS à Office 365 avec Microsoft Graph. Vous pouvez nous faire part de vos questions et suggestions dans la rubrique [Problèmes]() de ce référentiel. 91 | 92 | Si vous avez des questions sur le développement d’Office 365, envoyez-les sur [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Veillez à poser vos questions ou à rédiger vos commentaires avec les tags [MicrosoftGraph] et [Office 365]. 93 | 94 | ## Contribution 95 | Vous devrez signer un [Contrat de licence de contributeur](https://cla.microsoft.com/) avant d’envoyer votre requête de tirage. Pour compléter le contrat de licence de contributeur (CLA), vous devez envoyer une requête en remplissant le formulaire, puis signer électroniquement le CLA quand vous recevrez le courrier électronique contenant le lien vers le document. 96 | 97 | Ce projet a adopté le [code de conduite Microsoft Open Source](https://opensource.microsoft.com/codeofconduct/). Pour plus d’informations, reportez-vous à la [FAQ relative au code de conduite](https://opensource.microsoft.com/codeofconduct/faq/) ou contactez [opencode@microsoft.com](mailto:opencode@microsoft.com) pour toute question ou tout commentaire. 98 | 99 | ## Ressources supplémentaires 100 | 101 | * [Centre de développement Office](http://dev.office.com/) 102 | * [Page de présentation de Microsoft Graph](https://graph.microsoft.io) 103 | * [Utilisation de CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 104 | 105 | ## Copyright 106 | Copyright (c) 2016 Microsoft. Tous droits réservés. 107 | 108 | -------------------------------------------------------------------------------- /README-Localized/README-de-de.md: -------------------------------------------------------------------------------- 1 | # Office 365 Connect-Beispiel für iOS unter Verwendung des Microsoft Graph-SDKs 2 | 3 | Microsoft Graph ist ein einheitlicher Endpunkt für den Zugriff auf Daten, Beziehungen und Erkenntnisse, die von der Microsoft-Cloud stammen. In diesem Beispiel wird gezeigt, wie Sie eine Verbindung damit herstellen und die Authentifizierung ausführen, und dann E-Mails und Benutzer-APIs über das [Microsoft Graph-SDK für iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) aufrufen. 4 | 5 | > Hinweis: Testen Sie die Seite des [App-Registrierungsportals von Microsoft Graph](https://graph.microsoft.io/en-us/app-registration), durch das die Registrierung erleichtert wird, sodass Sie schneller mit diesem Beispiel loslegen können. 6 | 7 | ## Voraussetzungen 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) von Apple - Dieses Beispiel wird derzeit getestet und auf Version 7.3.1 von Xcode unterstützt. 9 | * Installation von [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) als ein Abhängigkeits-Manager. 10 | * Ein geschäftliches oder persönliches Microsoft-E-Mail-Konto, z. B. Office 365 oder outlook.com, hotmail.com usw. Sie können sich für ein [Office 365-Entwicklerabonnement](https://aka.ms/devprogramsignup) registrieren. Dieses umfasst die Ressourcen, die Sie zum Erstellen von Office 365-Apps benötigen. 11 | 12 | > Hinweis: Wenn Sie bereits über ein Abonnement verfügen, gelangen Sie über den vorherigen Link zu einer Seite mit der Meldung *Leider können Sie Ihrem aktuellen Konto diesen Inhalt nicht hinzufügen*. Verwenden Sie in diesem Fall ein Konto aus Ihrem aktuellen Office 365-Abonnement. 13 | * Eine Client-ID aus der registrierten App unter dem [App-Registrierungsportal von Microsoft Graph](https://graph.microsoft.io/en-us/app-registration) 14 | * Um Anforderungen auszuführen, muss ein **MSAuthenticationProvider** bereitgestellt werden, der HTTPS-Anforderungen mit einem entsprechenden OAuth 2.0-Bearertoken authentifizieren kann. Wir verwenden [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) für eine Beispielimplementierung von MSAuthenticationProvider, die Sie für einen Schnelleinstieg in Ihr Projekt verwenden können. Weitere Informationen finden Sie im folgenden Abschnitt **Interessanter Code**. 15 | 16 | 17 | ## Ausführen dieses Beispiels in Xcode 18 | 19 | 1. Klonen dieses Repositorys 20 | 2. Verwenden Sie CocoaPods, um das Microsoft Graph-SDK und Authentifizierungsabhängigkeiten zu importieren: 21 | 22 | pod 'MSGraphSDK' 23 | pod 'MSGraphSDK-NXOAuth2Adapter' 24 | 25 | 26 | Diese Beispiel-App enthält bereits eine POD-Datei, die die Pods in das Projekt überträgt. Navigieren Sie einfach über das **Terminal** zum Projekt, und führen Sie Folgendes aus: 27 | 28 | pod install 29 | 30 | Weitere Informationen finden Sie im Thema über das **Verwenden von CocoaPods** in [Zusätzliche Ressourcen](#AdditionalResources). 31 | 32 | 3. Öffnen Sie **Graph-iOS-Swift-Connect.xcworkspace**. 33 | 4. Öffnen Sie **AutheticationConstants.swift** unter dem Anwendungsordner. Sie werden sehen, dass die **clientId** aus dem Registrierungsprozess zu dieser Datei hinzugefügt werden kann. 34 | 35 | ```swift 36 | static let clientId = "ENTER_YOUR_CLIENT_ID" 37 | ``` 38 | > Hinweis: Sie sehen, dass die folgenden Berechtigungsbereiche für dieses Projekt konfiguriert wurden: **"https://graph.microsoft.com/Mail.Send", "https://graph.microsoft.com/User.Read", "Offline_access"**. Die in diesem Projekt verwendeten Dienstaufrufe, also das Senden einer E-Mail an Ihr E-Mail-Konto und das Abrufen einiger Profilinformationen (Anzeigename, E-Mail-Adresse) benötigen diese Berechtigungen, damit die App ordnungsgemäß ausgeführt wird. 39 | 40 | 41 | 5. Führen Sie das Beispiel aus. Sie werden aufgefordert, eine Verbindung zu einem geschäftlichen oder persönlichen E-Mail-Konto herzustellen oder zu authentifizieren. Dann können Sie eine E-Mail an dieses Konto oder an ein anderes ausgewähltes E-Mail-Konto senden. 42 | 43 | 44 | ##Interessanter Code 45 | 46 | Der gesamte Authentifizierungscode kann in der Datei **Authentication.swift** angezeigt werden. Wir verwenden eine Beispielimplementierung von MSAuthenticationProvider, die über [NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) hinaus erweitert wurde, um Anmeldeinformationen für registrierte systemeigene Apps, eine automatische Aktualisierung von Zugriffstoken sowie eine Abmeldefunktion bereitzustellen: 47 | ```swift 48 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 49 | 50 | if NXOAuth2AuthenticationProvider.sharedAuthProvider().loginSilent() == true { 51 | completion(error: nil) 52 | } 53 | else { 54 | NXOAuth2AuthenticationProvider.sharedAuthProvider() 55 | .loginWithViewController(nil) { (error: NSError?) in 56 | 57 | if let nserror = error { 58 | completion(error: MSGraphError.NSErrorType(error: nserror)) 59 | } 60 | else { 61 | completion(error: nil) 62 | } 63 | } 64 | } 65 | ... 66 | func disconnect() { 67 | NXOAuth2AuthenticationProvider.sharedAuthProvider().logout() 68 | } 69 | 70 | ``` 71 | 72 | 73 | Nachdem der Authentifizierungsanbieter festgelegt wurde, können wir ein Clientobjekt (MSGraphClient) erstellen und initialisieren, das für Aufrufe des Microsoft Graph-Dienstendpunkts (E-Mail und Benutzer) verwendet wird. In **SendMailViewcontroller.swift** können wir eine E-Mail-Anforderung erstellen und diese mithilfe des folgenden Codes senden: 74 | 75 | ```swift 76 | let requestBuilder = graphClient.me().sendMailWithMessage(message, saveToSentItems: false) 77 | let mailRequest = requestBuilder.request() 78 | 79 | mailRequest.executeWithCompletion({ 80 | (response: [NSObject : AnyObject]?, error: NSError?) in 81 | ... 82 | }) 83 | 84 | ``` 85 | 86 | Weitere Informationen, einschließlich des Codes zum Aufrufen anderer Dienste wie OneDrive, finden Sie im [Microsoft Graph-SDK für iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) 87 | 88 | ## Fragen und Kommentare 89 | 90 | Wir schätzen Ihr Feedback hinsichtlich des Office 365 iOS Microsoft Graph Connect-Projekts. Sie können uns Ihre Fragen und Vorschläge über den Abschnitt [Probleme]() dieses Repositorys senden. 91 | 92 | Allgemeine Fragen zur Office 365-Entwicklung sollten in [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API) gestellt werden. Stellen Sie sicher, dass Ihre Fragen oder Kommentare mit [Office365] und [MicrosoftGraph] markiert sind. 93 | 94 | ## Mitwirkung 95 | Vor dem Senden Ihrer Pull Request müssen Sie eine [Lizenzvereinbarung für Teilnehmer](https://cla.microsoft.com/) unterschreiben. Zum Vervollständigen der Lizenzvereinbarung für Teilnehmer (Contributor License Agreement, CLA) müssen Sie eine Anforderung über das Formular senden. Nachdem Sie die E-Mail mit dem Link zum Dokument empfangen haben, müssen Sie die CLA anschließend elektronisch signieren. 96 | 97 | In diesem Projekt wurden die [Microsoft Open Source-Verhaltensregeln](https://opensource.microsoft.com/codeofconduct/) übernommen. Weitere Informationen finden Sie unter [Häufig gestellte Fragen zu Verhaltensregeln](https://opensource.microsoft.com/codeofconduct/faq/), oder richten Sie Ihre Fragen oder Kommentare an [opencode@microsoft.com](mailto:opencode@microsoft.com). 98 | 99 | ## Zusätzliche Ressourcen 100 | 101 | * [Office Dev Center](http://dev.office.com/) 102 | * [Microsoft Graph-Übersichtsseite](https://graph.microsoft.io) 103 | * [Verwenden von CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 104 | 105 | ## Copyright 106 | Copyright (c) 2016 Microsoft. Alle Rechte vorbehalten. 107 | 108 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Office 365 Connect Sample for iOS (Swift) Using the Microsoft Graph SDK 2 | 3 | Microsoft Graph is a unified endpoint for accessing data, relationships and insights that come from the Microsoft Cloud. This sample shows how to connect and authenticate to it, and then call mail and user APIs through the [Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios). 4 | 5 | > Note: Try out the [Microsoft Graph App Registration Portal](https://graph.microsoft.io/en-us/app-registration) page which simplifies registration so you can get this sample running faster. 6 | 7 | ## Prerequisites 8 | * [Xcode](https://developer.apple.com/xcode/downloads/) from Apple -This sample is currently tested and supported on version 8.2.1 of Xcode. 9 | * Installation of [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) as a dependency manager. 10 | * A Microsoft work or personal email account such as Office 365, or outlook.com, hotmail.com, etc. You can sign up for [an Office 365 Developer subscription](https://aka.ms/devprogramsignup) that includes the resources that you need to start building Office 365 apps. 11 | 12 | > Note: If you already have a subscription, the previous link sends you to a page with the message *Sorry, you can’t add that to your current account*. In that case, use an account from your current Office 365 subscription. 13 | * A client id from the registered app at [Microsoft Graph App Registration Portal](https://graph.microsoft.io/en-us/app-registration) 14 | * To make requests, an **MSAuthenticationProvider** must be provided which is capable of authenticating HTTPS requests with an appropriate OAuth 2.0 bearer token. We will be using [msgraph-sdk-ios-nxoauth2-adapter](https://github.com/microsoftgraph/msgraph-sdk-ios-nxoauth2-adapter) for a sample implementation of MSAuthenticationProvider that can be used to jump-start your project. See the below section **Code of Interest** for more information. 15 | 16 | >**Note:** The sample was tested on Xcode 8.2.1. This sample supports Xcode 8 and iOS10, which uses the Swift 3.0 framework. 17 | 18 | ## Running this sample in Xcode 19 | 20 | 1. Clone this repository 21 | 2. Use CocoaPods to import the Microsoft Graph SDK and authentication dependencies: 22 | 23 | pod 'MSGraphSDK' 24 | pod 'MSGraphSDK-NXOAuth2Adapter' 25 | 26 | 27 | This sample app already contains a podfile that will get the pods into the project. Simply navigate to the project From **Terminal** and run: 28 | 29 | pod install 30 | 31 | For more information, see **Using CocoaPods** in [Additional Resources](#AdditionalResources) 32 | 33 | 3. Open **Graph-iOS-Swift-Connect.xcworkspace** 34 | 4. Open **AutheticationConstants.swift** under Application folder. You'll see that the **clientId** from the registration process can be added to this file. 35 | 36 | ```swift 37 | static let clientId = "ENTER_YOUR_CLIENT_ID" 38 | ``` 39 | > Note: You'll notice that the following permission scopes have been configured for this project: **"https://graph.microsoft.com/Mail.Send", "https://graph.microsoft.com/User.Read", "offline_access"**. The service calls used in this project, sending a mail to your mail account and retriving some profile information (Display Name, Email Address) require these permissions for the app to run properly. 40 | 41 | 42 | 5. Run the sample. You'll be asked to connect/authenticate to a work or personal mail account, and then you can send a mail to that account, or to another selected email account. 43 | 44 | 45 | ## Code of Interest 46 | 47 | All authentication code can be viewed in the **Authentication.swift** file. We use a sample implementation of MSAuthenticationProvider extended from [NXOAuth2Client](https://github.com/nxtbgthng/OAuth2Client) to provide login support for registered native apps, automatic refreshing of access tokens, and logout functionality: 48 | 49 | ### Authenticate the user 50 | 51 | ```swift 52 | // Set client ID 53 | NXOAuth2AuthenticationProvider.setClientId(clientId, scopes: scopes) 54 | 55 | // Try silent log in. This will attempt to sign in if there is a previous successful 56 | // sign in user information. 57 | if NXOAuth2AuthenticationProvider.sharedAuth().loginSilent() == true { 58 | completion(nil) 59 | } 60 | // Otherwise, present log in controller. 61 | else { 62 | NXOAuth2AuthenticationProvider.sharedAuth() 63 | .login(with: nil) { (error: Error?) in 64 | 65 | if let nserror = error { 66 | completion(MSGraphError.nsErrorType(error: nserror as NSError)) 67 | } 68 | else { 69 | completion(nil) 70 | } 71 | } 72 | } 73 | ... 74 | 75 | func disconnect() { 76 | NXOAuth2AuthenticationProvider.sharedAuth().logout() 77 | } 78 | 79 | ``` 80 | Once the authentication provider is set, we can create and initialize a client object (MSGraphClient) that will be used to make calls against the Microsoft Graph service endpoint (mail and users). In **SendViewcontroller.swift** we can assemble a mail request and send it using the following code: 81 | 82 | ### Get user profile picture 83 | 84 | ```swift 85 | self.graphClient.me().photoValue().download { 86 | (url: URL?, response: URLResponse?, error: Error?) in 87 | 88 | guard let picUrl = url else { 89 | return 90 | } 91 | 92 | let picData = NSData(contentsOf: picUrl) 93 | let picImage = UIImage(data: picData! as Data) 94 | 95 | if let validPic = picImage { 96 | completion(.success(validPic)) 97 | } 98 | } 99 | 100 | ``` 101 | ### Upload the picture to OneDrive 102 | 103 | ```swift 104 | let data = UIImageJPEGRepresentation(unwrappedImage, 1.0) 105 | self.graphClient 106 | .me() 107 | .drive() 108 | .root() 109 | .children() 110 | .driveItem("me.png") 111 | .contentRequest() 112 | .upload(from: data, completion: { 113 | (driveItem: MSGraphDriveItem?, error: Error?) in 114 | if let nsError = error { 115 | return 116 | } else { 117 | webUrl = (driveItem?.webUrl)! 118 | } 119 | }) 120 | 121 | ``` 122 | 123 | ### Attach the picture to a new email message 124 | 125 | ```swift 126 | let fileAttachment = MSGraphFileAttachment() 127 | let data = UIImageJPEGRepresentation(unwrappedImage, 1.0) 128 | fileAttachment.contentType = "image/png" 129 | fileAttachment.oDataType = "#microsoft.graph.fileAttachment" 130 | fileAttachment.contentBytes = data?.base64EncodedString() 131 | fileAttachment.name = "me.png" 132 | message.attachments.append(fileAttachment) 133 | 134 | ``` 135 | 136 | ### Send the message 137 | 138 | ```swift 139 | let requestBuilder = graphClient.me().sendMail(with: message, saveToSentItems: false) 140 | let mailRequest = requestBuilder?.request() 141 | 142 | mailRequest?.execute(completion: { 143 | (response: [AnyHashable: Any]?, error: Error?) in 144 | if let nsError = error { 145 | print(NSLocalizedString("ERROR", comment: ""), nsError.localizedDescription) 146 | DispatchQueue.main.async(execute: { 147 | self.statusTextView.text = NSLocalizedString("SEND_FAILURE", comment: "") 148 | }) 149 | 150 | } 151 | 152 | ... 153 | 154 | ``` 155 | 156 | For more information, including code to call into other services like OneDrive, see the [Microsoft Graph SDK for iOS](https://github.com/microsoftgraph/msgraph-sdk-ios) 157 | 158 | ## Questions and comments 159 | 160 | We'd love to get your feedback about the Office 365 iOS Microsoft Graph Connect project. You can send your questions and suggestions to us in the [Issues]() section of this repository. 161 | 162 | Questions about Office 365 development in general should be posted to [Stack Overflow](http://stackoverflow.com/questions/tagged/Office365+API). Make sure that your questions or comments are tagged with [Office365] and [MicrosoftGraph]. 163 | 164 | ## Contributing 165 | You will need to sign a [Contributor License Agreement](https://cla.microsoft.com/) before submitting your pull request. To complete the Contributor License Agreement (CLA), you will need to submit a request via the form and then electronically sign the CLA when you receive the email containing the link to the document. 166 | 167 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 168 | 169 | ## Additional resources 170 | 171 | * [Office Dev Center](http://dev.office.com/) 172 | * [Microsoft Graph overview page](https://graph.microsoft.io) 173 | * [Using CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 174 | 175 | ## Copyright 176 | Copyright (c) 2016 Microsoft. All rights reserved. 177 | 178 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/SendViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | 7 | import UIKit 8 | 9 | enum GraphResult { 10 | case success(T) 11 | case failure(Error) 12 | } 13 | 14 | class SendViewController: UIViewController { 15 | 16 | @IBOutlet var disconnectButton: UIBarButtonItem! 17 | @IBOutlet var descriptionLabel: UILabel! 18 | 19 | @IBOutlet var headerLabel: UILabel! 20 | @IBOutlet var emailTextField: UITextField! 21 | @IBOutlet var sendButton: UIButton! 22 | 23 | @IBOutlet var statusTextView: UITextView! 24 | 25 | var userPicture: UIImage? = nil 26 | var userPictureUrl: String? = nil 27 | 28 | var authentication: Authentication! 29 | lazy var graphClient: MSGraphClient = { 30 | 31 | let client = MSGraphClient.defaultClient() 32 | return client! 33 | }() 34 | 35 | 36 | /* 37 | * Before the mail send button is visible to the user, this function must: 38 | * 1. Get the user's profile information 39 | * 2. Get the user's profile picture 40 | * 3. Upload the picture to the user's OneDrive drive 41 | * 4. Get a sharing link to the picture 42 | * 43 | * Each of these tasks are asynchronous and called from the completion handler of 44 | * the previous async function. 45 | */ 46 | override func viewDidLoad() { 47 | super.viewDidLoad() 48 | self.sendButton.isHidden = true 49 | MSGraphClient.setAuthenticationProvider(authentication.authenticationProvider) 50 | self.initUI() 51 | 52 | getUserInfo() {(grapUser) in 53 | 54 | DispatchQueue.main.async(execute: { 55 | //Enable the send button 56 | self.sendButton.isHidden = false 57 | }) 58 | 59 | self.getUserPicture(forUser: self.emailTextField.text!) { (result) in 60 | switch (result){ 61 | case .success(let result): 62 | self.userPicture = result 63 | self.uploadPictureToOneDrive(uploadFile: self.userPicture, with: { (results) in 64 | switch(results){ 65 | case .success(let results): 66 | self.userPictureUrl = results 67 | break 68 | case .failure(let error): 69 | DispatchQueue.main.async(execute: { 70 | self.statusTextView.text = NSLocalizedString("UPLOAD_TO_ONEDRIVE_FAILURE", comment: error.localizedDescription) 71 | }) 72 | } 73 | }) 74 | break 75 | case .failure(let error): 76 | //get default picture 77 | self.userPicture = UIImage(named: "test") 78 | 79 | DispatchQueue.main.async(execute: { 80 | self.statusTextView.text = NSLocalizedString("PROFILE_PICTURE_FAILURE", comment: error.localizedDescription) 81 | }) 82 | break 83 | } 84 | } 85 | } 86 | } 87 | 88 | func initUI() { 89 | self.title = NSLocalizedString("Microsoft Graph Connect", comment: "") 90 | self.disconnectButton.title = NSLocalizedString("DISCONNECT", comment: "") 91 | self.descriptionLabel.text = "You're now connected to Microsoft Graph. Tap the button below to send a message from your account using the Microsoft Graph API." 92 | self.sendButton.setTitle(NSLocalizedString("SEND", comment: ""), for: UIControlState()) 93 | } 94 | override func viewWillAppear(_ animated: Bool) { 95 | super.viewWillAppear(animated) 96 | self.navigationItem.setHidesBackButton(true, animated: true) 97 | } 98 | } 99 | 100 | 101 | // MARK: Actions 102 | extension SendViewController { 103 | @IBAction func disconnectGraph(_ sender: AnyObject) { 104 | self.disconnect() 105 | } 106 | 107 | @IBAction func sendMail(_ sender: AnyObject) { 108 | guard let toEmail = self.emailTextField.text else {return} 109 | guard let picUrl = self.userPictureUrl else {return} 110 | if let message = self.createSampleMessage(to: toEmail, picLink: picUrl) { 111 | 112 | let requestBuilder = graphClient.me().sendMail(with: message, saveToSentItems: false) 113 | let mailRequest = requestBuilder?.request() 114 | 115 | _ = mailRequest?.execute(completion: { 116 | (response: [AnyHashable: Any]?, error: Error?) in 117 | if let nsError = error { 118 | print(NSLocalizedString("ERROR", comment: ""), nsError.localizedDescription) 119 | DispatchQueue.main.async(execute: { 120 | self.statusTextView.text = NSLocalizedString("SEND_FAILURE", comment: "") 121 | }) 122 | } 123 | else { 124 | DispatchQueue.main.async(execute: { 125 | self.descriptionLabel.text = "Check your inbox. You have a new message :)" 126 | self.statusTextView.text = NSLocalizedString("SEND_SUCCESS", comment: "") 127 | }) 128 | } 129 | }) 130 | } 131 | } 132 | } 133 | 134 | 135 | // MARK: Graph Helper 136 | extension SendViewController { 137 | func disconnect() { 138 | authentication.disconnect() 139 | self.navigationController?.popViewController(animated: true) 140 | } 141 | 142 | /** 143 | Fetches user information such as mail and display name 144 | */ 145 | func getUserInfo(with completion: @escaping (_ grapUser: MSGraphUser) ->Void){ 146 | self.sendButton.isEnabled = false 147 | self.statusTextView.text = NSLocalizedString("LOADING_USER_INFO", comment: "") 148 | 149 | self.graphClient.me().request().getWithCompletion { 150 | (user: MSGraphUser?, error: Error?) in 151 | if let graphError = error { 152 | print(NSLocalizedString("ERROR", comment: ""), graphError) 153 | DispatchQueue.main.async(execute: { 154 | self.statusTextView.text = NSLocalizedString("GRAPH_ERROR", comment: "") 155 | }) 156 | } 157 | else { 158 | guard let userInfo = user else { 159 | DispatchQueue.main.async(execute: { 160 | self.statusTextView.text = NSLocalizedString("USER_INFO_LOAD_FAILURE", comment: "") 161 | }) 162 | return 163 | } 164 | DispatchQueue.main.async(execute: { 165 | self.emailTextField.text = userInfo.userPrincipalName 166 | 167 | if let displayName = userInfo.displayName { 168 | self.headerLabel.text = "Hi " + displayName 169 | } 170 | else { 171 | self.headerLabel.text = NSString(format: NSLocalizedString("HI_USER", comment: "") as NSString, "") as String 172 | } 173 | 174 | self.statusTextView.text = NSLocalizedString("USER_INFO_LOAD_SUCCESS", comment: "") 175 | self.sendButton.isEnabled = true 176 | }) 177 | completion(userInfo) 178 | } 179 | } 180 | } 181 | 182 | /** 183 | Uploads the user's profile picture (obtained via the Graph API) to the user's OneDrive drive. The OneDrive sharing url is 184 | returned in the completion handler. 185 | */ 186 | func uploadPictureToOneDrive(uploadFile image: UIImage?, with completion: @escaping (_ result: GraphResult) ->Void) { 187 | 188 | var webUrl: String = "" 189 | guard let unwrappedImage = image else { 190 | return 191 | } 192 | let data = UIImageJPEGRepresentation(unwrappedImage, 1.0) 193 | self.graphClient 194 | .me() 195 | .drive() 196 | .root() 197 | .children() 198 | .driveItem("me.png") 199 | .contentRequest() 200 | .upload(from: data, completion: { 201 | (driveItem: MSGraphDriveItem?, error: Error?) in 202 | if let nsError = error { 203 | print(NSLocalizedString("ERROR", comment: ""), nsError.localizedDescription) 204 | DispatchQueue.main.async(execute: { 205 | self.statusTextView.text = NSLocalizedString("UPLOAD_PICTURE_FAILURE", comment: nsError.localizedDescription) 206 | }) 207 | return 208 | 209 | } else { 210 | webUrl = (driveItem?.webUrl)! 211 | completion(.success(webUrl)) 212 | } 213 | }) 214 | } 215 | 216 | 217 | /** 218 | Gets the user's profile picture. Returns the picture as a UIImage via completion handler 219 | */ 220 | func getUserPicture(forUser upn: String, with completion: @escaping (_ result: GraphResult) -> Void) { 221 | 222 | //Asynchronous Graph call. Closure is invoked after getUserPicture completes. Requires @escaping attribute 223 | self.graphClient.me().photoValue().download { 224 | (url: URL?, response: URLResponse?, error: Error?) in 225 | 226 | if let nsError = error { 227 | print(NSLocalizedString("ERROR", comment: ""), nsError.localizedDescription) 228 | DispatchQueue.main.async(execute: { 229 | self.statusTextView.text = NSLocalizedString("GET_PICTURE_FAILURE", comment: nsError.localizedDescription) 230 | }) 231 | return 232 | } 233 | guard let picUrl = url else { 234 | DispatchQueue.main.async(execute: { 235 | self.statusTextView.text = NSLocalizedString("GET_PICTURE_FAILURE", comment: "User profile picture is nil") 236 | }) 237 | return 238 | } 239 | print(picUrl) 240 | 241 | let picData = NSData(contentsOf: picUrl) 242 | let picImage = UIImage(data: picData! as Data) 243 | 244 | if let validPic = picImage { 245 | completion(.success(validPic)) 246 | } 247 | else { 248 | DispatchQueue.main.async(execute: { 249 | self.statusTextView.text = NSLocalizedString("GET_PICTURE_FAILURE", comment: "Picture data is invalid") 250 | }) 251 | } 252 | } 253 | } 254 | /** 255 | Creates sample email message 256 | 257 | - parameter emailAddress: recipient email address 258 | 259 | - returns: MSGraphMessage object with given recipient. The body is created from EmailBody.html 260 | */ 261 | func createSampleMessage(to emailAddress: String, picLink pictureUrl: String) -> MSGraphMessage? { 262 | let message = MSGraphMessage() 263 | 264 | // set recipients 265 | 266 | let _ = self.userPicture 267 | let toRecipient = MSGraphRecipient() 268 | let msEmailAddress = MSGraphEmailAddress() 269 | msEmailAddress.address = emailAddress 270 | toRecipient.emailAddress = msEmailAddress 271 | let toRecipientList = [toRecipient] 272 | message.toRecipients = toRecipientList 273 | message.subject = NSLocalizedString("MAIL_SUBJECT", comment: "") 274 | let messageBody = MSGraphItemBody() 275 | messageBody.contentType = MSGraphBodyType.html() 276 | guard let emailBodyFilePath = Bundle.main.path(forResource: "EmailBody", ofType: "html") else {return nil} 277 | messageBody.content = try! String(contentsOfFile: emailBodyFilePath, encoding: String.Encoding.utf8) 278 | messageBody.content = messageBody.content.replacingOccurrences(of: "a href=%s", with: ("a href=" + pictureUrl)) 279 | message.body = messageBody 280 | 281 | if let unwrappedImage = self.userPicture { 282 | let fileAttachment = MSGraphFileAttachment() 283 | let data = UIImageJPEGRepresentation(unwrappedImage, 1.0) 284 | fileAttachment.contentType = "image/png" 285 | fileAttachment.oDataType = "#microsoft.graph.fileAttachment" 286 | fileAttachment.contentBytes = data?.base64EncodedString() 287 | fileAttachment.name = "me.png" 288 | message.attachments.append(fileAttachment) 289 | } 290 | return message 291 | } 292 | } 293 | 294 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 89 | 100 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | Status text 114 | This is where the status is displayed 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /Graph-iOS-Swift-Connect.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9683C8191CE4545000ADD241 /* Authentication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9683C8181CE4545000ADD241 /* Authentication.swift */; }; 11 | 968F3AC81CE339AF00EC4DFC /* EmailBody.html in Resources */ = {isa = PBXBuildFile; fileRef = 968F3AC71CE339AF00EC4DFC /* EmailBody.html */; }; 12 | 9697B5951D1B0843004F8396 /* Graph_iOS_Swift_ConnectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9697B5941D1B0843004F8396 /* Graph_iOS_Swift_ConnectTests.swift */; }; 13 | 96993F381CE13E9200725E65 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96993F371CE13E9200725E65 /* AppDelegate.swift */; }; 14 | 96993F3D1CE13E9200725E65 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96993F3B1CE13E9200725E65 /* Main.storyboard */; }; 15 | 96993F3F1CE13E9200725E65 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96993F3E1CE13E9200725E65 /* Assets.xcassets */; }; 16 | 96993F421CE13E9200725E65 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96993F401CE13E9200725E65 /* LaunchScreen.storyboard */; }; 17 | 96993F4A1CE1489700725E65 /* ConnectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96993F491CE1489700725E65 /* ConnectViewController.swift */; }; 18 | 96993F4C1CE1493300725E65 /* ApplicationConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96993F4B1CE1493300725E65 /* ApplicationConstants.swift */; }; 19 | 96993F541CE1E36500725E65 /* SendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96993F531CE1E36500725E65 /* SendViewController.swift */; }; 20 | 96EDF8C21D1C60FB00B6A083 /* testUserArgs.json in Resources */ = {isa = PBXBuildFile; fileRef = 96EDF8C11D1C60FB00B6A083 /* testUserArgs.json */; }; 21 | 96EDF8C41D1C720F00B6A083 /* testAuthProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96EDF8C31D1C720F00B6A083 /* testAuthProvider.swift */; }; 22 | BF8C469C57C839FF7CEA4CA0 /* libPods-Graph-iOS-Swift-Connect.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CAAA84DB1595E6551BE7CE8 /* libPods-Graph-iOS-Swift-Connect.a */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 9697B5971D1B0843004F8396 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 96993F2C1CE13E9200725E65 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 96993F331CE13E9200725E65; 31 | remoteInfo = "Graph-iOS-Swift-Connect"; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | 3CAAA84DB1595E6551BE7CE8 /* libPods-Graph-iOS-Swift-Connect.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Graph-iOS-Swift-Connect.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 40D0BDAB3B15CA7832337193 /* Pods-Graph-iOS-Swift-Connect.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Graph-iOS-Swift-Connect.release.xcconfig"; path = "Pods/Target Support Files/Pods-Graph-iOS-Swift-Connect/Pods-Graph-iOS-Swift-Connect.release.xcconfig"; sourceTree = ""; }; 38 | 6E4213140B6EC54ADE4337F8 /* Pods-Graph-iOS-Swift-Connect.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Graph-iOS-Swift-Connect.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Graph-iOS-Swift-Connect/Pods-Graph-iOS-Swift-Connect.debug.xcconfig"; sourceTree = ""; }; 39 | 9683C8181CE4545000ADD241 /* Authentication.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Authentication.swift; sourceTree = ""; }; 40 | 968F3AC71CE339AF00EC4DFC /* EmailBody.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = EmailBody.html; sourceTree = ""; }; 41 | 9697B5921D1B0842004F8396 /* Graph-iOS-Swift-ConnectTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Graph-iOS-Swift-ConnectTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 9697B5941D1B0843004F8396 /* Graph_iOS_Swift_ConnectTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Graph_iOS_Swift_ConnectTests.swift; sourceTree = ""; }; 43 | 9697B5961D1B0843004F8396 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 96993F341CE13E9200725E65 /* Graph-iOS-Swift-Connect.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Graph-iOS-Swift-Connect.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 96993F371CE13E9200725E65 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 46 | 96993F3C1CE13E9200725E65 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 96993F3E1CE13E9200725E65 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | 96993F411CE13E9200725E65 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | 96993F431CE13E9200725E65 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 96993F491CE1489700725E65 /* ConnectViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectViewController.swift; sourceTree = ""; }; 51 | 96993F4B1CE1493300725E65 /* ApplicationConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplicationConstants.swift; sourceTree = ""; }; 52 | 96993F501CE1643B00725E65 /* Graph-iOS-Swift-Connect-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Graph-iOS-Swift-Connect-Bridging-Header.h"; sourceTree = ""; }; 53 | 96993F531CE1E36500725E65 /* SendViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendViewController.swift; sourceTree = ""; }; 54 | 96EDF8C11D1C60FB00B6A083 /* testUserArgs.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = testUserArgs.json; sourceTree = ""; }; 55 | 96EDF8C31D1C720F00B6A083 /* testAuthProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = testAuthProvider.swift; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 9697B58F1D1B0842004F8396 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 96993F311CE13E9200725E65 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | BF8C469C57C839FF7CEA4CA0 /* libPods-Graph-iOS-Swift-Connect.a in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 08C71E486308D4B75D06BED4 /* Frameworks */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 3CAAA84DB1595E6551BE7CE8 /* libPods-Graph-iOS-Swift-Connect.a */, 81 | ); 82 | name = Frameworks; 83 | sourceTree = ""; 84 | }; 85 | 9682B8BD1CEA8A7400EEA064 /* Authentication */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 9683C8181CE4545000ADD241 /* Authentication.swift */, 89 | ); 90 | name = Authentication; 91 | sourceTree = ""; 92 | }; 93 | 9682B8BE1CEA8A7E00EEA064 /* Resources */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 96993F431CE13E9200725E65 /* Info.plist */, 97 | 96993F3E1CE13E9200725E65 /* Assets.xcassets */, 98 | 968F3AC71CE339AF00EC4DFC /* EmailBody.html */, 99 | ); 100 | name = Resources; 101 | sourceTree = ""; 102 | }; 103 | 9682B8BF1CEA8A8800EEA064 /* Views */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 96993F3B1CE13E9200725E65 /* Main.storyboard */, 107 | 96993F401CE13E9200725E65 /* LaunchScreen.storyboard */, 108 | ); 109 | name = Views; 110 | sourceTree = ""; 111 | }; 112 | 9682B8C01CEA8A9A00EEA064 /* Controllers */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 96993F371CE13E9200725E65 /* AppDelegate.swift */, 116 | 96993F491CE1489700725E65 /* ConnectViewController.swift */, 117 | 96993F531CE1E36500725E65 /* SendViewController.swift */, 118 | ); 119 | name = Controllers; 120 | sourceTree = ""; 121 | }; 122 | 9682B8C11CEA8AEE00EEA064 /* Application */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 96993F501CE1643B00725E65 /* Graph-iOS-Swift-Connect-Bridging-Header.h */, 126 | 96993F4B1CE1493300725E65 /* ApplicationConstants.swift */, 127 | ); 128 | name = Application; 129 | sourceTree = ""; 130 | }; 131 | 9697B5931D1B0843004F8396 /* Graph-iOS-Swift-ConnectTests */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 96EDF8C31D1C720F00B6A083 /* testAuthProvider.swift */, 135 | 9697B5941D1B0843004F8396 /* Graph_iOS_Swift_ConnectTests.swift */, 136 | 9697B5961D1B0843004F8396 /* Info.plist */, 137 | 96EDF8C11D1C60FB00B6A083 /* testUserArgs.json */, 138 | ); 139 | path = "Graph-iOS-Swift-ConnectTests"; 140 | sourceTree = ""; 141 | }; 142 | 96993F2B1CE13E9200725E65 = { 143 | isa = PBXGroup; 144 | children = ( 145 | 96993F361CE13E9200725E65 /* Graph-iOS-Swift-Connect */, 146 | 9697B5931D1B0843004F8396 /* Graph-iOS-Swift-ConnectTests */, 147 | 96993F351CE13E9200725E65 /* Products */, 148 | A08CA26B30D42354CED4A4B4 /* Pods */, 149 | 08C71E486308D4B75D06BED4 /* Frameworks */, 150 | ); 151 | sourceTree = ""; 152 | }; 153 | 96993F351CE13E9200725E65 /* Products */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 96993F341CE13E9200725E65 /* Graph-iOS-Swift-Connect.app */, 157 | 9697B5921D1B0842004F8396 /* Graph-iOS-Swift-ConnectTests.xctest */, 158 | ); 159 | name = Products; 160 | sourceTree = ""; 161 | }; 162 | 96993F361CE13E9200725E65 /* Graph-iOS-Swift-Connect */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 9682B8BD1CEA8A7400EEA064 /* Authentication */, 166 | 9682B8C11CEA8AEE00EEA064 /* Application */, 167 | 9682B8C01CEA8A9A00EEA064 /* Controllers */, 168 | 9682B8BF1CEA8A8800EEA064 /* Views */, 169 | 9682B8BE1CEA8A7E00EEA064 /* Resources */, 170 | ); 171 | path = "Graph-iOS-Swift-Connect"; 172 | sourceTree = ""; 173 | }; 174 | A08CA26B30D42354CED4A4B4 /* Pods */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | 6E4213140B6EC54ADE4337F8 /* Pods-Graph-iOS-Swift-Connect.debug.xcconfig */, 178 | 40D0BDAB3B15CA7832337193 /* Pods-Graph-iOS-Swift-Connect.release.xcconfig */, 179 | ); 180 | name = Pods; 181 | sourceTree = ""; 182 | }; 183 | /* End PBXGroup section */ 184 | 185 | /* Begin PBXNativeTarget section */ 186 | 9697B5911D1B0842004F8396 /* Graph-iOS-Swift-ConnectTests */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = 9697B59B1D1B0843004F8396 /* Build configuration list for PBXNativeTarget "Graph-iOS-Swift-ConnectTests" */; 189 | buildPhases = ( 190 | 9697B58E1D1B0842004F8396 /* Sources */, 191 | 9697B58F1D1B0842004F8396 /* Frameworks */, 192 | 9697B5901D1B0842004F8396 /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | 9697B5981D1B0843004F8396 /* PBXTargetDependency */, 198 | ); 199 | name = "Graph-iOS-Swift-ConnectTests"; 200 | productName = "Graph-iOS-Swift-ConnectTests"; 201 | productReference = 9697B5921D1B0842004F8396 /* Graph-iOS-Swift-ConnectTests.xctest */; 202 | productType = "com.apple.product-type.bundle.unit-test"; 203 | }; 204 | 96993F331CE13E9200725E65 /* Graph-iOS-Swift-Connect */ = { 205 | isa = PBXNativeTarget; 206 | buildConfigurationList = 96993F461CE13E9200725E65 /* Build configuration list for PBXNativeTarget "Graph-iOS-Swift-Connect" */; 207 | buildPhases = ( 208 | E77E8C30EDFE738BD8674C1F /* [CP] Check Pods Manifest.lock */, 209 | 96993F301CE13E9200725E65 /* Sources */, 210 | 96993F311CE13E9200725E65 /* Frameworks */, 211 | 96993F321CE13E9200725E65 /* Resources */, 212 | DF691CE7AD6D51319643861B /* [CP] Embed Pods Frameworks */, 213 | 592737BEEB40E7FC3D103B45 /* [CP] Copy Pods Resources */, 214 | ); 215 | buildRules = ( 216 | ); 217 | dependencies = ( 218 | ); 219 | name = "Graph-iOS-Swift-Connect"; 220 | productName = "Graph-iOS-Swift-Connect"; 221 | productReference = 96993F341CE13E9200725E65 /* Graph-iOS-Swift-Connect.app */; 222 | productType = "com.apple.product-type.application"; 223 | }; 224 | /* End PBXNativeTarget section */ 225 | 226 | /* Begin PBXProject section */ 227 | 96993F2C1CE13E9200725E65 /* Project object */ = { 228 | isa = PBXProject; 229 | attributes = { 230 | LastSwiftUpdateCheck = 0730; 231 | LastUpgradeCheck = 0730; 232 | ORGANIZATIONNAME = "Jason Kim"; 233 | TargetAttributes = { 234 | 9697B5911D1B0842004F8396 = { 235 | CreatedOnToolsVersion = 7.3.1; 236 | LastSwiftMigration = 0820; 237 | TestTargetID = 96993F331CE13E9200725E65; 238 | }; 239 | 96993F331CE13E9200725E65 = { 240 | CreatedOnToolsVersion = 7.3.1; 241 | LastSwiftMigration = 0820; 242 | }; 243 | }; 244 | }; 245 | buildConfigurationList = 96993F2F1CE13E9200725E65 /* Build configuration list for PBXProject "Graph-iOS-Swift-Connect" */; 246 | compatibilityVersion = "Xcode 3.2"; 247 | developmentRegion = English; 248 | hasScannedForEncodings = 0; 249 | knownRegions = ( 250 | en, 251 | Base, 252 | ); 253 | mainGroup = 96993F2B1CE13E9200725E65; 254 | productRefGroup = 96993F351CE13E9200725E65 /* Products */; 255 | projectDirPath = ""; 256 | projectRoot = ""; 257 | targets = ( 258 | 96993F331CE13E9200725E65 /* Graph-iOS-Swift-Connect */, 259 | 9697B5911D1B0842004F8396 /* Graph-iOS-Swift-ConnectTests */, 260 | ); 261 | }; 262 | /* End PBXProject section */ 263 | 264 | /* Begin PBXResourcesBuildPhase section */ 265 | 9697B5901D1B0842004F8396 /* Resources */ = { 266 | isa = PBXResourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | 96EDF8C21D1C60FB00B6A083 /* testUserArgs.json in Resources */, 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | }; 273 | 96993F321CE13E9200725E65 /* Resources */ = { 274 | isa = PBXResourcesBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | 96993F421CE13E9200725E65 /* LaunchScreen.storyboard in Resources */, 278 | 96993F3F1CE13E9200725E65 /* Assets.xcassets in Resources */, 279 | 96993F3D1CE13E9200725E65 /* Main.storyboard in Resources */, 280 | 968F3AC81CE339AF00EC4DFC /* EmailBody.html in Resources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXResourcesBuildPhase section */ 285 | 286 | /* Begin PBXShellScriptBuildPhase section */ 287 | 592737BEEB40E7FC3D103B45 /* [CP] Copy Pods Resources */ = { 288 | isa = PBXShellScriptBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | ); 292 | inputPaths = ( 293 | ); 294 | name = "[CP] Copy Pods Resources"; 295 | outputPaths = ( 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | shellPath = /bin/sh; 299 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Graph-iOS-Swift-Connect/Pods-Graph-iOS-Swift-Connect-resources.sh\"\n"; 300 | showEnvVarsInLog = 0; 301 | }; 302 | DF691CE7AD6D51319643861B /* [CP] Embed Pods Frameworks */ = { 303 | isa = PBXShellScriptBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | ); 307 | inputPaths = ( 308 | ); 309 | name = "[CP] Embed Pods Frameworks"; 310 | outputPaths = ( 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | shellPath = /bin/sh; 314 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Graph-iOS-Swift-Connect/Pods-Graph-iOS-Swift-Connect-frameworks.sh\"\n"; 315 | showEnvVarsInLog = 0; 316 | }; 317 | E77E8C30EDFE738BD8674C1F /* [CP] Check Pods Manifest.lock */ = { 318 | isa = PBXShellScriptBuildPhase; 319 | buildActionMask = 2147483647; 320 | files = ( 321 | ); 322 | inputPaths = ( 323 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 324 | "${PODS_ROOT}/Manifest.lock", 325 | ); 326 | name = "[CP] Check Pods Manifest.lock"; 327 | outputPaths = ( 328 | "$(DERIVED_FILE_DIR)/Pods-Graph-iOS-Swift-Connect-checkManifestLockResult.txt", 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | shellPath = /bin/sh; 332 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 333 | showEnvVarsInLog = 0; 334 | }; 335 | /* End PBXShellScriptBuildPhase section */ 336 | 337 | /* Begin PBXSourcesBuildPhase section */ 338 | 9697B58E1D1B0842004F8396 /* Sources */ = { 339 | isa = PBXSourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | 96EDF8C41D1C720F00B6A083 /* testAuthProvider.swift in Sources */, 343 | 9697B5951D1B0843004F8396 /* Graph_iOS_Swift_ConnectTests.swift in Sources */, 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | }; 347 | 96993F301CE13E9200725E65 /* Sources */ = { 348 | isa = PBXSourcesBuildPhase; 349 | buildActionMask = 2147483647; 350 | files = ( 351 | 96993F541CE1E36500725E65 /* SendViewController.swift in Sources */, 352 | 96993F381CE13E9200725E65 /* AppDelegate.swift in Sources */, 353 | 9683C8191CE4545000ADD241 /* Authentication.swift in Sources */, 354 | 96993F4A1CE1489700725E65 /* ConnectViewController.swift in Sources */, 355 | 96993F4C1CE1493300725E65 /* ApplicationConstants.swift in Sources */, 356 | ); 357 | runOnlyForDeploymentPostprocessing = 0; 358 | }; 359 | /* End PBXSourcesBuildPhase section */ 360 | 361 | /* Begin PBXTargetDependency section */ 362 | 9697B5981D1B0843004F8396 /* PBXTargetDependency */ = { 363 | isa = PBXTargetDependency; 364 | target = 96993F331CE13E9200725E65 /* Graph-iOS-Swift-Connect */; 365 | targetProxy = 9697B5971D1B0843004F8396 /* PBXContainerItemProxy */; 366 | }; 367 | /* End PBXTargetDependency section */ 368 | 369 | /* Begin PBXVariantGroup section */ 370 | 96993F3B1CE13E9200725E65 /* Main.storyboard */ = { 371 | isa = PBXVariantGroup; 372 | children = ( 373 | 96993F3C1CE13E9200725E65 /* Base */, 374 | ); 375 | name = Main.storyboard; 376 | sourceTree = ""; 377 | }; 378 | 96993F401CE13E9200725E65 /* LaunchScreen.storyboard */ = { 379 | isa = PBXVariantGroup; 380 | children = ( 381 | 96993F411CE13E9200725E65 /* Base */, 382 | ); 383 | name = LaunchScreen.storyboard; 384 | sourceTree = ""; 385 | }; 386 | /* End PBXVariantGroup section */ 387 | 388 | /* Begin XCBuildConfiguration section */ 389 | 9697B5991D1B0843004F8396 /* Debug */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | BUNDLE_LOADER = "$(TEST_HOST)"; 393 | INFOPLIST_FILE = "Graph-iOS-Swift-ConnectTests/Info.plist"; 394 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 395 | PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.Graph-iOS-Swift-ConnectTests"; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | SWIFT_VERSION = 3.0; 398 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Graph-iOS-Swift-Connect.app/Graph-iOS-Swift-Connect"; 399 | }; 400 | name = Debug; 401 | }; 402 | 9697B59A1D1B0843004F8396 /* Release */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | BUNDLE_LOADER = "$(TEST_HOST)"; 406 | INFOPLIST_FILE = "Graph-iOS-Swift-ConnectTests/Info.plist"; 407 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 408 | PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.Graph-iOS-Swift-ConnectTests"; 409 | PRODUCT_NAME = "$(TARGET_NAME)"; 410 | SWIFT_VERSION = 3.0; 411 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Graph-iOS-Swift-Connect.app/Graph-iOS-Swift-Connect"; 412 | }; 413 | name = Release; 414 | }; 415 | 96993F441CE13E9200725E65 /* Debug */ = { 416 | isa = XCBuildConfiguration; 417 | buildSettings = { 418 | ALWAYS_SEARCH_USER_PATHS = NO; 419 | CLANG_ANALYZER_NONNULL = YES; 420 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 421 | CLANG_CXX_LIBRARY = "libc++"; 422 | CLANG_ENABLE_MODULES = YES; 423 | CLANG_ENABLE_OBJC_ARC = YES; 424 | CLANG_WARN_BOOL_CONVERSION = YES; 425 | CLANG_WARN_CONSTANT_CONVERSION = YES; 426 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 427 | CLANG_WARN_EMPTY_BODY = YES; 428 | CLANG_WARN_ENUM_CONVERSION = YES; 429 | CLANG_WARN_INT_CONVERSION = YES; 430 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 431 | CLANG_WARN_UNREACHABLE_CODE = YES; 432 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 433 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 434 | COPY_PHASE_STRIP = NO; 435 | DEBUG_INFORMATION_FORMAT = dwarf; 436 | ENABLE_STRICT_OBJC_MSGSEND = YES; 437 | ENABLE_TESTABILITY = YES; 438 | GCC_C_LANGUAGE_STANDARD = gnu99; 439 | GCC_DYNAMIC_NO_PIC = NO; 440 | GCC_NO_COMMON_BLOCKS = YES; 441 | GCC_OPTIMIZATION_LEVEL = 0; 442 | GCC_PREPROCESSOR_DEFINITIONS = ( 443 | "DEBUG=1", 444 | "$(inherited)", 445 | ); 446 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 447 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 448 | GCC_WARN_UNDECLARED_SELECTOR = YES; 449 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 450 | GCC_WARN_UNUSED_FUNCTION = YES; 451 | GCC_WARN_UNUSED_VARIABLE = YES; 452 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 453 | MTL_ENABLE_DEBUG_INFO = YES; 454 | ONLY_ACTIVE_ARCH = YES; 455 | SDKROOT = iphoneos; 456 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 457 | }; 458 | name = Debug; 459 | }; 460 | 96993F451CE13E9200725E65 /* Release */ = { 461 | isa = XCBuildConfiguration; 462 | buildSettings = { 463 | ALWAYS_SEARCH_USER_PATHS = NO; 464 | CLANG_ANALYZER_NONNULL = YES; 465 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 466 | CLANG_CXX_LIBRARY = "libc++"; 467 | CLANG_ENABLE_MODULES = YES; 468 | CLANG_ENABLE_OBJC_ARC = YES; 469 | CLANG_WARN_BOOL_CONVERSION = YES; 470 | CLANG_WARN_CONSTANT_CONVERSION = YES; 471 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 472 | CLANG_WARN_EMPTY_BODY = YES; 473 | CLANG_WARN_ENUM_CONVERSION = YES; 474 | CLANG_WARN_INT_CONVERSION = YES; 475 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 476 | CLANG_WARN_UNREACHABLE_CODE = YES; 477 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 478 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 479 | COPY_PHASE_STRIP = NO; 480 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 481 | ENABLE_NS_ASSERTIONS = NO; 482 | ENABLE_STRICT_OBJC_MSGSEND = YES; 483 | GCC_C_LANGUAGE_STANDARD = gnu99; 484 | GCC_NO_COMMON_BLOCKS = YES; 485 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 486 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 487 | GCC_WARN_UNDECLARED_SELECTOR = YES; 488 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 489 | GCC_WARN_UNUSED_FUNCTION = YES; 490 | GCC_WARN_UNUSED_VARIABLE = YES; 491 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 492 | MTL_ENABLE_DEBUG_INFO = NO; 493 | SDKROOT = iphoneos; 494 | VALIDATE_PRODUCT = YES; 495 | }; 496 | name = Release; 497 | }; 498 | 96993F471CE13E9200725E65 /* Debug */ = { 499 | isa = XCBuildConfiguration; 500 | baseConfigurationReference = 6E4213140B6EC54ADE4337F8 /* Pods-Graph-iOS-Swift-Connect.debug.xcconfig */; 501 | buildSettings = { 502 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 503 | CLANG_ENABLE_MODULES = YES; 504 | INFOPLIST_FILE = "Graph-iOS-Swift-Connect/Info.plist"; 505 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 507 | PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.Graph-iOS-Swift-Connect"; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | SWIFT_OBJC_BRIDGING_HEADER = "Graph-iOS-Swift-Connect/Graph-iOS-Swift-Connect-Bridging-Header.h"; 510 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 511 | SWIFT_VERSION = 3.0; 512 | }; 513 | name = Debug; 514 | }; 515 | 96993F481CE13E9200725E65 /* Release */ = { 516 | isa = XCBuildConfiguration; 517 | baseConfigurationReference = 40D0BDAB3B15CA7832337193 /* Pods-Graph-iOS-Swift-Connect.release.xcconfig */; 518 | buildSettings = { 519 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 520 | CLANG_ENABLE_MODULES = YES; 521 | INFOPLIST_FILE = "Graph-iOS-Swift-Connect/Info.plist"; 522 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 523 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 524 | PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.Graph-iOS-Swift-Connect"; 525 | PRODUCT_NAME = "$(TARGET_NAME)"; 526 | SWIFT_OBJC_BRIDGING_HEADER = "Graph-iOS-Swift-Connect/Graph-iOS-Swift-Connect-Bridging-Header.h"; 527 | SWIFT_VERSION = 3.0; 528 | }; 529 | name = Release; 530 | }; 531 | /* End XCBuildConfiguration section */ 532 | 533 | /* Begin XCConfigurationList section */ 534 | 9697B59B1D1B0843004F8396 /* Build configuration list for PBXNativeTarget "Graph-iOS-Swift-ConnectTests" */ = { 535 | isa = XCConfigurationList; 536 | buildConfigurations = ( 537 | 9697B5991D1B0843004F8396 /* Debug */, 538 | 9697B59A1D1B0843004F8396 /* Release */, 539 | ); 540 | defaultConfigurationIsVisible = 0; 541 | defaultConfigurationName = Release; 542 | }; 543 | 96993F2F1CE13E9200725E65 /* Build configuration list for PBXProject "Graph-iOS-Swift-Connect" */ = { 544 | isa = XCConfigurationList; 545 | buildConfigurations = ( 546 | 96993F441CE13E9200725E65 /* Debug */, 547 | 96993F451CE13E9200725E65 /* Release */, 548 | ); 549 | defaultConfigurationIsVisible = 0; 550 | defaultConfigurationName = Release; 551 | }; 552 | 96993F461CE13E9200725E65 /* Build configuration list for PBXNativeTarget "Graph-iOS-Swift-Connect" */ = { 553 | isa = XCConfigurationList; 554 | buildConfigurations = ( 555 | 96993F471CE13E9200725E65 /* Debug */, 556 | 96993F481CE13E9200725E65 /* Release */, 557 | ); 558 | defaultConfigurationIsVisible = 0; 559 | defaultConfigurationName = Release; 560 | }; 561 | /* End XCConfigurationList section */ 562 | }; 563 | rootObject = 96993F2C1CE13E9200725E65 /* Project object */; 564 | } 565 | --------------------------------------------------------------------------------