├── .DS_Store ├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── azure-pipelines.yml └── quickstart ├── .DS_Store └── sample-device ├── .DS_Store ├── MQTT Client Sample-Bridging-Header.h ├── MQTT Client Sample.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── yizhon.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── yizhon.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── MQTT Client Sample ├── .DS_Store ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist └── ViewController.swift └── Podfile /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/azure-iot-samples-ios/de53db223bf3be2fcc0e00f0e0ccad6e166c0e5f/.DS_Store -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 4 | > Please provide us with the following information: 5 | > --------------------------------------------------------------- 6 | 7 | ### This issue is for a: (mark with an `x`) 8 | ``` 9 | - [ ] bug report -> please search issues before submitting 10 | - [ ] feature request 11 | - [ ] documentation issue or request 12 | - [ ] regression (a behavior that used to work and stopped in a new release) 13 | ``` 14 | 15 | ### Minimal steps to reproduce 16 | > 17 | 18 | ### Any log messages given by the failure 19 | > 20 | 21 | ### Expected/desired behavior 22 | > 23 | 24 | ### OS and Version? 25 | > Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?) 26 | 27 | ### Versions 28 | > 29 | 30 | ### Mention any other details that might be useful 31 | 32 | > --------------------------------------------------------------- 33 | > Thanks! We'll be in touch soon. 34 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | 3 | * ... 4 | 5 | ## Does this introduce a breaking change? 6 | 7 | ``` 8 | [ ] Yes 9 | [ ] No 10 | ``` 11 | 12 | ## Pull Request Type 13 | What kind of change does this Pull Request introduce? 14 | 15 | 16 | ``` 17 | [ ] Bugfix 18 | [ ] Feature 19 | [ ] Code style update (formatting, local variables) 20 | [ ] Refactoring (no functional changes, no api changes) 21 | [ ] Documentation content changes 22 | [ ] Other... Please describe: 23 | ``` 24 | 25 | ## How to Test 26 | * Get the code 27 | 28 | ``` 29 | git clone [repo-address] 30 | cd [repo-name] 31 | git checkout [branch-name] 32 | npm install 33 | ``` 34 | 35 | * Test the code 36 | 37 | ``` 38 | ``` 39 | 40 | ## What to Check 41 | Verify that the following are valid 42 | * ... 43 | 44 | ## Other Information 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # .NET Core 46 | project.lock.json 47 | project.fragment.lock.json 48 | artifacts/ 49 | **/Properties/launchSettings.json 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # Visual Studio code coverage results 117 | *.coverage 118 | *.coveragexml 119 | 120 | # NCrunch 121 | _NCrunch_* 122 | .*crunch*.local.xml 123 | nCrunchTemp_* 124 | 125 | # MightyMoose 126 | *.mm.* 127 | AutoTest.Net/ 128 | 129 | # Web workbench (sass) 130 | .sass-cache/ 131 | 132 | # Installshield output folder 133 | [Ee]xpress/ 134 | 135 | # DocProject is a documentation generator add-in 136 | DocProject/buildhelp/ 137 | DocProject/Help/*.HxT 138 | DocProject/Help/*.HxC 139 | DocProject/Help/*.hhc 140 | DocProject/Help/*.hhk 141 | DocProject/Help/*.hhp 142 | DocProject/Help/Html2 143 | DocProject/Help/html 144 | 145 | # Click-Once directory 146 | publish/ 147 | 148 | # Publish Web Output 149 | *.[Pp]ublish.xml 150 | *.azurePubxml 151 | # TODO: Comment the next line if you want to checkin your web deploy settings 152 | # but database connection strings (with potential passwords) will be unencrypted 153 | *.pubxml 154 | *.publishproj 155 | 156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 157 | # checkin your Azure Web App publish settings, but sensitive information contained 158 | # in these scripts will be unencrypted 159 | PublishScripts/ 160 | 161 | # NuGet Packages 162 | *.nupkg 163 | # The packages folder can be ignored because of Package Restore 164 | **/packages/* 165 | # except build/, which is used as an MSBuild target. 166 | !**/packages/build/ 167 | # Uncomment if necessary however generally it will be regenerated when needed 168 | #!**/packages/repositories.config 169 | # NuGet v3's project.json files produces more ignorable files 170 | *.nuget.props 171 | *.nuget.targets 172 | 173 | # Microsoft Azure Build Output 174 | csx/ 175 | *.build.csdef 176 | 177 | # Microsoft Azure Emulator 178 | ecf/ 179 | rcf/ 180 | 181 | # Windows Store app package directories and files 182 | AppPackages/ 183 | BundleArtifacts/ 184 | Package.StoreAssociation.xml 185 | _pkginfo.txt 186 | 187 | # Visual Studio cache files 188 | # files ending in .cache can be ignored 189 | *.[Cc]ache 190 | # but keep track of directories ending in .cache 191 | !*.[Cc]ache/ 192 | 193 | # Others 194 | ClientBin/ 195 | ~$* 196 | *~ 197 | *.dbmdl 198 | *.dbproj.schemaview 199 | *.jfm 200 | *.pfx 201 | *.publishsettings 202 | orleans.codegen.cs 203 | 204 | # Since there are multiple workflows, uncomment next line to ignore bower_components 205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 206 | #bower_components/ 207 | 208 | # RIA/Silverlight projects 209 | Generated_Code/ 210 | 211 | # Backup & report files from converting an old project file 212 | # to a newer Visual Studio version. Backup files are not needed, 213 | # because we have git ;-) 214 | _UpgradeReport_Files/ 215 | Backup*/ 216 | UpgradeLog*.XML 217 | UpgradeLog*.htm 218 | 219 | # SQL Server files 220 | *.mdf 221 | *.ldf 222 | *.ndf 223 | 224 | # Business Intelligence projects 225 | *.rdl.data 226 | *.bim.layout 227 | *.bim_*.settings 228 | 229 | # Microsoft Fakes 230 | FakesAssemblies/ 231 | 232 | # GhostDoc plugin setting file 233 | *.GhostDoc.xml 234 | 235 | # Node.js Tools for Visual Studio 236 | .ntvs_analysis.dat 237 | node_modules/ 238 | 239 | # Typescript v1 declaration files 240 | typings/ 241 | 242 | # Visual Studio 6 build log 243 | *.plg 244 | 245 | # Visual Studio 6 workspace options file 246 | *.opt 247 | 248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 249 | *.vbw 250 | 251 | # Visual Studio LightSwitch build output 252 | **/*.HTMLClient/GeneratedArtifacts 253 | **/*.DesktopClient/GeneratedArtifacts 254 | **/*.DesktopClient/ModelManifest.xml 255 | **/*.Server/GeneratedArtifacts 256 | **/*.Server/ModelManifest.xml 257 | _Pvt_Extensions 258 | 259 | # Paket dependency manager 260 | .paket/paket.exe 261 | paket-files/ 262 | 263 | # FAKE - F# Make 264 | .fake/ 265 | 266 | # JetBrains Rider 267 | .idea/ 268 | *.sln.iml 269 | 270 | # CodeRush 271 | .cr/ 272 | 273 | # Python Tools for Visual Studio (PTVS) 274 | __pycache__/ 275 | *.pyc 276 | 277 | # Cake - Uncomment if you are using it 278 | # tools/** 279 | # !tools/packages.config 280 | 281 | # Telerik's JustMock configuration file 282 | *.jmconfig 283 | 284 | # BizTalk build output 285 | *.btp.cs 286 | *.btm.cs 287 | *.odx.cs 288 | *.xsd.cs 289 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to [project-title] 2 | 3 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 4 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 5 | the rights to use your contribution. For details, visit https://cla.microsoft.com. 6 | 7 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide 8 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions 9 | provided by the bot. You will only need to do this once across all repos using our CLA. 10 | 11 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 12 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 13 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 14 | 15 | - [Code of Conduct](#coc) 16 | - [Issues and Bugs](#issue) 17 | - [Feature Requests](#feature) 18 | - [Submission Guidelines](#submit) 19 | 20 | ## Code of Conduct 21 | Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 22 | 23 | ## Found an Issue? 24 | If you find a bug in the source code or a mistake in the documentation, you can help us by 25 | [submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can 26 | [submit a Pull Request](#submit-pr) with a fix. 27 | 28 | ## Want a Feature? 29 | You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub 30 | Repository. If you would like to *implement* a new feature, please submit an issue with 31 | a proposal for your work first, to be sure that we can use it. 32 | 33 | * **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr). 34 | 35 | ## Submission Guidelines 36 | 37 | ### Submitting an Issue 38 | Before you submit an issue, search the archive, maybe your question was already answered. 39 | 40 | If your issue appears to be a bug, and hasn't been reported, open a new issue. 41 | Help us to maximize the effort we can spend fixing issues and adding new 42 | features, by not reporting duplicate issues. Providing the following information will increase the 43 | chances of your issue being dealt with quickly: 44 | 45 | * **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps 46 | * **Version** - what version is affected (e.g. 0.1.2) 47 | * **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you 48 | * **Browsers and Operating System** - is this a problem with all browsers? 49 | * **Reproduce the Error** - provide a live example or a unambiguous set of steps 50 | * **Related Issues** - has a similar issue been reported before? 51 | * **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be 52 | causing the problem (line of code or commit) 53 | 54 | You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/[organization-name]/[repository-name]/issues/new]. 55 | 56 | ### Submitting a Pull Request (PR) 57 | Before you submit your Pull Request (PR) consider the following guidelines: 58 | 59 | * Search the repository (https://github.com/[organization-name]/[repository-name]/pulls) for an open or closed PR 60 | that relates to your submission. You don't want to duplicate effort. 61 | 62 | * Make your changes in a new git fork: 63 | 64 | * Commit your changes using a descriptive commit message 65 | * Push your fork to GitHub: 66 | * In GitHub, create a pull request 67 | * If we suggest changes then: 68 | * Make the required updates. 69 | * Rebase your fork and force push to your GitHub repository (this will update your Pull Request): 70 | 71 | ```shell 72 | git rebase master -i 73 | git push -f 74 | ``` 75 | 76 | That's it! Thank you for your contribution! 77 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | page_type: sample 3 | languages: 4 | - swift 5 | products: 6 | - azure 7 | - azure-iot-hub 8 | description: "A set of easy-to-understand, continuously-tested samples for connecting to Azure IoT Hub via Azure/azure-iot-sdk-c/CocoaPod." 9 | --- 10 | 11 | # Azure IoT samples for iOS platform 12 | 13 | azure-iot-samples-iot provides a set of easy-to-understand, continuously-tested samples for connecting to Azure IoT Hub via Azure/azure-iot-sdk-c/CocoaPod 14 | 15 | ## Prerequisites 16 | 17 | - This repository cloned or downloaded onto your development machine. 18 | - An IoT hub in your Azure subscription. If you don't have an IoT hub, follow the steps in [Create an IoT hub](https://learn.microsoft.com/azure/iot-hub/iot-hub-create-through-portal). 19 | - A device registered in your IoT hub. If you don't have a device, follow the steps in [Create and manage device identities](https://learn.microsoft.com/en-us/azure/iot-hub/create-connect-device) to register a device and retrieve its device connection string. 20 | - The latest version of [XCode](https://developer.apple.com/xcode/), running the latest version of the iOS SDK. This quickstart was tested with XCode 9.3 and iOS 11.3. 21 | - The latest version of [CocoaPods](https://guides.cocoapods.org/using/getting-started.html). 22 | 23 | ## Simulate an IoT device 24 | 25 | In this section, you simulate an iOS device running a Swift application to receive cloud-to-device messages from the IoT hub. 26 | 27 | ### Install CocoaPods 28 | 29 | CocoaPods manages dependencies for iOS projects that use third-party libraries. 30 | 31 | In a terminal window, navigate to the folder containing this repository on your development machine. Then, navigate to the sample project folder: 32 | 33 | ```sh 34 | cd quickstart/sample-device 35 | ``` 36 | 37 | Make sure that XCode is closed, then run the following command to install the CocoaPods that are declared in the **podfile** file: 38 | 39 | ```sh 40 | pod install 41 | ``` 42 | 43 | Along with installing the pods required for your project, the installation command also created an XCode workspace file that is already configured to use the pods for dependencies. 44 | 45 | ### Run the sample device application 46 | 47 | 1. Retrieve the connection string for your device. You can copy this string from the [Azure portal](https://portal.azure.com) in the device details page, or retrieve it with the following CLI command: 48 | 49 | ```azurecli-interactive 50 | az iot hub device-identity connection-string show --hub-name {YourIoTHubName} --device-id {YourDeviceID} --output table 51 | ``` 52 | 53 | 2. Open the sample workspace in XCode. 54 | 55 | ```sh 56 | open "MQTT Client Sample.xcworkspace" 57 | ``` 58 | 59 | 3. Expand the **MQTT Client Sample** project and then folder of the same name. 60 | 61 | 4. Open **ViewController.swift** for editing in XCode. 62 | 63 | 5. Search for the **connectionString** variable and update the value with the device connection string that you copied in the first step. 64 | 65 | 6. Save your changes. 66 | 67 | 7. Run the project in the device emulator with the **Build and run** button or the key combo **command + r**. 68 | 69 | ## Send a cloud-to-device message 70 | 71 | You're now ready to receive cloud-to-device messages. Use the Azure portal to send a test cloud-to-device message to your simulated IoT device. 72 | 73 | 1. In the **iOS App Sample** app running on the simulated IoT device, select **Start**. The application starts sending device-to-cloud messages, but also starts listening for cloud-to-device messages. 74 | 75 | 2. In the [Azure portal](https://portal.azure.com), navigate to your IoT hub. 76 | 77 | 3. Select **Device management** > **Devices** from the IoT Hub menu. 78 | 79 | 4. On the **Devices** page, select the device ID for your simulated IoT device. 80 | 81 | 5. Select **Message to Device** to open the cloud-to-device message interface. 82 | 83 | 6. Write a plaintext message in the **Message body** text box, then select **Send message**. 84 | 85 | 7. Watch the app running on your simulated IoT device. It checks for messages from IoT Hub and prints the text from the most recent one on the screen. Your output should look like the following example: 86 | 87 | ## CocoaPods 88 | 89 | * [AzureIoTHubClient](https://cocoapods.org/pods/AzureIoTHubClient) contains the [Azure IoT Hub Client](https://github.com/azure/azure-iot-sdk-c) 90 | * [AzureIoTHubServiceClient](https://cocoapods.org/pods/AzureIoTHubServiceClient) contains the [Azure IoT Hub Service Client](https://github.com/azure/azure-iot-sdk-c) 91 | * [AzureIoTUtility](https://cocoapods.org/pods/AzureIoTUtility) contains the [Azure IoT C Shared Utility library](https://github.com/Azure/azure-c-shared-utility) 92 | * [AzureIoTuAmqp](https://cocoapods.org/pods/AzureIoTuAmqp) contains the [Azure IoT AMQP library](https://github.com/Azure/azure-uamqp-c) 93 | * [AzureIoTuMqtt](https://cocoapods.org/pods/AzureIoTuMqtt) contains the [Azure IoT MQTT library](https://github.com/Azure/azure-umqtt-c) 94 | 95 | ## Resources 96 | 97 | - [azure-iot-sdk-c](https://github.com/Azure/azure-iot-sdk-c): contains the source code for Azure IoT C SDK, as well as the platform specific adaption layer for iOS 98 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # Starter pipeline 2 | # Start with a minimal pipeline that you can customize to build and deploy your code. 3 | # Add steps that build, run tests, deploy, and more: 4 | # https://aka.ms/yaml 5 | 6 | trigger: 7 | - master 8 | 9 | pool: 10 | vmImage: ubuntu-latest 11 | 12 | steps: 13 | - script: echo Hello, world! 14 | displayName: 'Run a one-line script' 15 | 16 | - script: | 17 | echo Add other tasks to build, test, and deploy your project. 18 | echo See https://aka.ms/yaml 19 | displayName: 'Run a multi-line script' 20 | -------------------------------------------------------------------------------- /quickstart/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/azure-iot-samples-ios/de53db223bf3be2fcc0e00f0e0ccad6e166c0e5f/quickstart/.DS_Store -------------------------------------------------------------------------------- /quickstart/sample-device/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/azure-iot-samples-ios/de53db223bf3be2fcc0e00f0e0ccad6e166c0e5f/quickstart/sample-device/.DS_Store -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #ifndef azureiot_Bridging_Header_h 6 | #define azureiot_Bridging_Header_h 7 | 8 | #endif /* azureiot_Bridging_Header_h */ 9 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 046F4C4F205EF81B00BB453F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AEFC4091F7080E900E53319 /* ViewController.swift */; }; 11 | 5FE7157884D871F85D79D125 /* Pods_MQTT_Client_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE490015F9B94440B61437C6 /* Pods_MQTT_Client_Sample.framework */; }; 12 | 9AEFC4081F7080E900E53319 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AEFC4071F7080E900E53319 /* AppDelegate.swift */; }; 13 | 9AEFC40D1F7080E900E53319 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9AEFC40B1F7080E900E53319 /* Main.storyboard */; }; 14 | 9AEFC40F1F7080E900E53319 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9AEFC40E1F7080E900E53319 /* Assets.xcassets */; }; 15 | 9AEFC4121F7080E900E53319 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9AEFC4101F7080E900E53319 /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 9AEFC4041F7080E900E53319 /* MQTT Client Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "MQTT Client Sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 9AEFC4071F7080E900E53319 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 9AEFC4091F7080E900E53319 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 22 | 9AEFC40C1F7080E900E53319 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | 9AEFC40E1F7080E900E53319 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | 9AEFC4111F7080E900E53319 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | 9AEFC4131F7080E900E53319 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | 9AEFC4B51F70921500E53319 /* MQTT Client Sample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MQTT Client Sample-Bridging-Header.h"; sourceTree = ""; }; 27 | B531E178D4CF0412F7608891 /* Pods-MQTT Client Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MQTT Client Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MQTT Client Sample/Pods-MQTT Client Sample.debug.xcconfig"; sourceTree = ""; }; 28 | CE490015F9B94440B61437C6 /* Pods_MQTT_Client_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MQTT_Client_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | EECE9C2FEA1FF3CA05016AFB /* Pods-MQTT Client Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MQTT Client Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-MQTT Client Sample/Pods-MQTT Client Sample.release.xcconfig"; sourceTree = ""; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | 9AEFC4011F7080E900E53319 /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | 5FE7157884D871F85D79D125 /* Pods_MQTT_Client_Sample.framework in Frameworks */, 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 3E7BB537B92E397AB037AE9E /* Frameworks */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | CE490015F9B94440B61437C6 /* Pods_MQTT_Client_Sample.framework */, 48 | ); 49 | name = Frameworks; 50 | sourceTree = ""; 51 | }; 52 | 9AEFC3FB1F7080E900E53319 = { 53 | isa = PBXGroup; 54 | children = ( 55 | 9AEFC4061F7080E900E53319 /* MQTT Client Sample */, 56 | 9AEFC4051F7080E900E53319 /* Products */, 57 | 9AEFC4B51F70921500E53319 /* MQTT Client Sample-Bridging-Header.h */, 58 | A2CB50324648BB34D70EF39B /* Pods */, 59 | 3E7BB537B92E397AB037AE9E /* Frameworks */, 60 | ); 61 | sourceTree = ""; 62 | }; 63 | 9AEFC4051F7080E900E53319 /* Products */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 9AEFC4041F7080E900E53319 /* MQTT Client Sample.app */, 67 | ); 68 | name = Products; 69 | sourceTree = ""; 70 | }; 71 | 9AEFC4061F7080E900E53319 /* MQTT Client Sample */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 9AEFC4071F7080E900E53319 /* AppDelegate.swift */, 75 | 9AEFC4091F7080E900E53319 /* ViewController.swift */, 76 | 9AEFC40B1F7080E900E53319 /* Main.storyboard */, 77 | 9AEFC40E1F7080E900E53319 /* Assets.xcassets */, 78 | 9AEFC4101F7080E900E53319 /* LaunchScreen.storyboard */, 79 | 9AEFC4131F7080E900E53319 /* Info.plist */, 80 | ); 81 | path = "MQTT Client Sample"; 82 | sourceTree = ""; 83 | }; 84 | A2CB50324648BB34D70EF39B /* Pods */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | B531E178D4CF0412F7608891 /* Pods-MQTT Client Sample.debug.xcconfig */, 88 | EECE9C2FEA1FF3CA05016AFB /* Pods-MQTT Client Sample.release.xcconfig */, 89 | ); 90 | name = Pods; 91 | sourceTree = ""; 92 | }; 93 | /* End PBXGroup section */ 94 | 95 | /* Begin PBXNativeTarget section */ 96 | 9AEFC4031F7080E900E53319 /* MQTT Client Sample */ = { 97 | isa = PBXNativeTarget; 98 | buildConfigurationList = 9AEFC4161F7080E900E53319 /* Build configuration list for PBXNativeTarget "MQTT Client Sample" */; 99 | buildPhases = ( 100 | BFAA78103DBF238EFE035967 /* [CP] Check Pods Manifest.lock */, 101 | 9AEFC4001F7080E900E53319 /* Sources */, 102 | 9AEFC4011F7080E900E53319 /* Frameworks */, 103 | 9AEFC4021F7080E900E53319 /* Resources */, 104 | 3766AA2A3536535815D2F492 /* [CP] Embed Pods Frameworks */, 105 | B190CE20EE4FA10D807AC7E2 /* [CP] Copy Pods Resources */, 106 | ); 107 | buildRules = ( 108 | ); 109 | dependencies = ( 110 | ); 111 | name = "MQTT Client Sample"; 112 | productName = "MQTT Client Sample"; 113 | productReference = 9AEFC4041F7080E900E53319 /* MQTT Client Sample.app */; 114 | productType = "com.apple.product-type.application"; 115 | }; 116 | /* End PBXNativeTarget section */ 117 | 118 | /* Begin PBXProject section */ 119 | 9AEFC3FC1F7080E900E53319 /* Project object */ = { 120 | isa = PBXProject; 121 | attributes = { 122 | LastSwiftUpdateCheck = 0830; 123 | LastUpgradeCheck = 0920; 124 | ORGANIZATIONNAME = "Mark Radbourne"; 125 | TargetAttributes = { 126 | 9AEFC4031F7080E900E53319 = { 127 | CreatedOnToolsVersion = 8.3.3; 128 | DevelopmentTeam = UBF8T346G9; 129 | LastSwiftMigration = 0920; 130 | ProvisioningStyle = Automatic; 131 | }; 132 | }; 133 | }; 134 | buildConfigurationList = 9AEFC3FF1F7080E900E53319 /* Build configuration list for PBXProject "MQTT Client Sample" */; 135 | compatibilityVersion = "Xcode 3.2"; 136 | developmentRegion = English; 137 | hasScannedForEncodings = 0; 138 | knownRegions = ( 139 | en, 140 | Base, 141 | ); 142 | mainGroup = 9AEFC3FB1F7080E900E53319; 143 | productRefGroup = 9AEFC4051F7080E900E53319 /* Products */; 144 | projectDirPath = ""; 145 | projectRoot = ""; 146 | targets = ( 147 | 9AEFC4031F7080E900E53319 /* MQTT Client Sample */, 148 | ); 149 | }; 150 | /* End PBXProject section */ 151 | 152 | /* Begin PBXResourcesBuildPhase section */ 153 | 9AEFC4021F7080E900E53319 /* Resources */ = { 154 | isa = PBXResourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | 9AEFC4121F7080E900E53319 /* LaunchScreen.storyboard in Resources */, 158 | 9AEFC40F1F7080E900E53319 /* Assets.xcassets in Resources */, 159 | 9AEFC40D1F7080E900E53319 /* Main.storyboard in Resources */, 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | }; 163 | /* End PBXResourcesBuildPhase section */ 164 | 165 | /* Begin PBXShellScriptBuildPhase section */ 166 | 3766AA2A3536535815D2F492 /* [CP] Embed Pods Frameworks */ = { 167 | isa = PBXShellScriptBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | ); 171 | inputPaths = ( 172 | "${SRCROOT}/Pods/Target Support Files/Pods-MQTT Client Sample/Pods-MQTT Client Sample-frameworks.sh", 173 | "${BUILT_PRODUCTS_DIR}/AzureIoTHubClient/AzureIoTHubClient.framework", 174 | "${BUILT_PRODUCTS_DIR}/AzureIoTUtility/AzureIoTUtility.framework", 175 | "${BUILT_PRODUCTS_DIR}/AzureIoTuAmqp/AzureIoTuAmqp.framework", 176 | "${BUILT_PRODUCTS_DIR}/AzureIoTuMqtt/AzureIoTuMqtt.framework", 177 | ); 178 | name = "[CP] Embed Pods Frameworks"; 179 | outputPaths = ( 180 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AzureIoTHubClient.framework", 181 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AzureIoTUtility.framework", 182 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AzureIoTuAmqp.framework", 183 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AzureIoTuMqtt.framework", 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | shellPath = /bin/sh; 187 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MQTT Client Sample/Pods-MQTT Client Sample-frameworks.sh\"\n"; 188 | showEnvVarsInLog = 0; 189 | }; 190 | B190CE20EE4FA10D807AC7E2 /* [CP] Copy Pods Resources */ = { 191 | isa = PBXShellScriptBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | ); 195 | inputPaths = ( 196 | ); 197 | name = "[CP] Copy Pods Resources"; 198 | outputPaths = ( 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | shellPath = /bin/sh; 202 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MQTT Client Sample/Pods-MQTT Client Sample-resources.sh\"\n"; 203 | showEnvVarsInLog = 0; 204 | }; 205 | BFAA78103DBF238EFE035967 /* [CP] Check Pods Manifest.lock */ = { 206 | isa = PBXShellScriptBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | ); 210 | inputPaths = ( 211 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 212 | "${PODS_ROOT}/Manifest.lock", 213 | ); 214 | name = "[CP] Check Pods Manifest.lock"; 215 | outputPaths = ( 216 | "$(DERIVED_FILE_DIR)/Pods-MQTT Client Sample-checkManifestLockResult.txt", 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | 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"; 221 | showEnvVarsInLog = 0; 222 | }; 223 | /* End PBXShellScriptBuildPhase section */ 224 | 225 | /* Begin PBXSourcesBuildPhase section */ 226 | 9AEFC4001F7080E900E53319 /* Sources */ = { 227 | isa = PBXSourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | 046F4C4F205EF81B00BB453F /* ViewController.swift in Sources */, 231 | 9AEFC4081F7080E900E53319 /* AppDelegate.swift in Sources */, 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | /* End PBXSourcesBuildPhase section */ 236 | 237 | /* Begin PBXVariantGroup section */ 238 | 9AEFC40B1F7080E900E53319 /* Main.storyboard */ = { 239 | isa = PBXVariantGroup; 240 | children = ( 241 | 9AEFC40C1F7080E900E53319 /* Base */, 242 | ); 243 | name = Main.storyboard; 244 | sourceTree = ""; 245 | }; 246 | 9AEFC4101F7080E900E53319 /* LaunchScreen.storyboard */ = { 247 | isa = PBXVariantGroup; 248 | children = ( 249 | 9AEFC4111F7080E900E53319 /* Base */, 250 | ); 251 | name = LaunchScreen.storyboard; 252 | sourceTree = ""; 253 | }; 254 | /* End PBXVariantGroup section */ 255 | 256 | /* Begin XCBuildConfiguration section */ 257 | 9AEFC4141F7080E900E53319 /* Debug */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_ANALYZER_NONNULL = YES; 262 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 263 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 264 | CLANG_CXX_LIBRARY = "libc++"; 265 | CLANG_ENABLE_MODULES = YES; 266 | CLANG_ENABLE_OBJC_ARC = YES; 267 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 268 | CLANG_WARN_BOOL_CONVERSION = YES; 269 | CLANG_WARN_COMMA = YES; 270 | CLANG_WARN_CONSTANT_CONVERSION = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 273 | CLANG_WARN_EMPTY_BODY = YES; 274 | CLANG_WARN_ENUM_CONVERSION = YES; 275 | CLANG_WARN_INFINITE_RECURSION = YES; 276 | CLANG_WARN_INT_CONVERSION = YES; 277 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 281 | CLANG_WARN_STRICT_PROTOTYPES = YES; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | DEBUG_INFORMATION_FORMAT = dwarf; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | ENABLE_TESTABILITY = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_DYNAMIC_NO_PIC = NO; 292 | GCC_NO_COMMON_BLOCKS = YES; 293 | GCC_OPTIMIZATION_LEVEL = 0; 294 | GCC_PREPROCESSOR_DEFINITIONS = ( 295 | "DEBUG=1", 296 | "$(inherited)", 297 | ); 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | HEADER_SEARCH_PATHS = ""; 305 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 306 | LIBRARY_SEARCH_PATHS = ""; 307 | MTL_ENABLE_DEBUG_INFO = YES; 308 | ONLY_ACTIVE_ARCH = YES; 309 | SDKROOT = iphoneos; 310 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 311 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 312 | TARGETED_DEVICE_FAMILY = "1,2"; 313 | USER_HEADER_SEARCH_PATHS = "../../azureiotiosbuild/azureout/include/azureiot ../../azureiotiosbuild/azureout/include"; 314 | }; 315 | name = Debug; 316 | }; 317 | 9AEFC4151F7080E900E53319 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ALWAYS_SEARCH_USER_PATHS = NO; 321 | CLANG_ANALYZER_NONNULL = YES; 322 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 323 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 324 | CLANG_CXX_LIBRARY = "libc++"; 325 | CLANG_ENABLE_MODULES = YES; 326 | CLANG_ENABLE_OBJC_ARC = YES; 327 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 328 | CLANG_WARN_BOOL_CONVERSION = YES; 329 | CLANG_WARN_COMMA = YES; 330 | CLANG_WARN_CONSTANT_CONVERSION = YES; 331 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 332 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INFINITE_RECURSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 338 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 340 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 341 | CLANG_WARN_STRICT_PROTOTYPES = YES; 342 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 343 | CLANG_WARN_UNREACHABLE_CODE = YES; 344 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 345 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 346 | COPY_PHASE_STRIP = NO; 347 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 348 | ENABLE_NS_ASSERTIONS = NO; 349 | ENABLE_STRICT_OBJC_MSGSEND = YES; 350 | GCC_C_LANGUAGE_STANDARD = gnu99; 351 | GCC_NO_COMMON_BLOCKS = YES; 352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 354 | GCC_WARN_UNDECLARED_SELECTOR = YES; 355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 356 | GCC_WARN_UNUSED_FUNCTION = YES; 357 | GCC_WARN_UNUSED_VARIABLE = YES; 358 | HEADER_SEARCH_PATHS = ""; 359 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 360 | LIBRARY_SEARCH_PATHS = ""; 361 | MTL_ENABLE_DEBUG_INFO = NO; 362 | SDKROOT = iphoneos; 363 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 364 | TARGETED_DEVICE_FAMILY = "1,2"; 365 | USER_HEADER_SEARCH_PATHS = "../../azureiotiosbuild/azureout/include/azureiot ../../azureiotiosbuild/azureout/include"; 366 | VALIDATE_PRODUCT = YES; 367 | VALID_ARCHS = "arm64 arm64e armv7 armv7s x86_64"; 368 | }; 369 | name = Release; 370 | }; 371 | 9AEFC4171F7080E900E53319 /* Debug */ = { 372 | isa = XCBuildConfiguration; 373 | baseConfigurationReference = B531E178D4CF0412F7608891 /* Pods-MQTT Client Sample.debug.xcconfig */; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | CLANG_ENABLE_MODULES = YES; 377 | DEVELOPMENT_TEAM = UBF8T346G9; 378 | INFOPLIST_FILE = "MQTT Client Sample/Info.plist"; 379 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.MQTT-Client-Sample"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | SWIFT_OBJC_BRIDGING_HEADER = "MQTT Client Sample-Bridging-Header.h"; 384 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 385 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 386 | SWIFT_VERSION = 4.0; 387 | VALID_ARCHS = "arm64 arm64e armv7 armv7s x86_64"; 388 | }; 389 | name = Debug; 390 | }; 391 | 9AEFC4181F7080E900E53319 /* Release */ = { 392 | isa = XCBuildConfiguration; 393 | baseConfigurationReference = EECE9C2FEA1FF3CA05016AFB /* Pods-MQTT Client Sample.release.xcconfig */; 394 | buildSettings = { 395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 396 | CLANG_ENABLE_MODULES = YES; 397 | DEVELOPMENT_TEAM = UBF8T346G9; 398 | INFOPLIST_FILE = "MQTT Client Sample/Info.plist"; 399 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 400 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 401 | PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.MQTT-Client-Sample"; 402 | PRODUCT_NAME = "$(TARGET_NAME)"; 403 | SWIFT_OBJC_BRIDGING_HEADER = "MQTT Client Sample-Bridging-Header.h"; 404 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 405 | SWIFT_VERSION = 4.0; 406 | }; 407 | name = Release; 408 | }; 409 | /* End XCBuildConfiguration section */ 410 | 411 | /* Begin XCConfigurationList section */ 412 | 9AEFC3FF1F7080E900E53319 /* Build configuration list for PBXProject "MQTT Client Sample" */ = { 413 | isa = XCConfigurationList; 414 | buildConfigurations = ( 415 | 9AEFC4141F7080E900E53319 /* Debug */, 416 | 9AEFC4151F7080E900E53319 /* Release */, 417 | ); 418 | defaultConfigurationIsVisible = 0; 419 | defaultConfigurationName = Release; 420 | }; 421 | 9AEFC4161F7080E900E53319 /* Build configuration list for PBXNativeTarget "MQTT Client Sample" */ = { 422 | isa = XCConfigurationList; 423 | buildConfigurations = ( 424 | 9AEFC4171F7080E900E53319 /* Debug */, 425 | 9AEFC4181F7080E900E53319 /* Release */, 426 | ); 427 | defaultConfigurationIsVisible = 0; 428 | defaultConfigurationName = Release; 429 | }; 430 | /* End XCConfigurationList section */ 431 | }; 432 | rootObject = 9AEFC3FC1F7080E900E53319 /* Project object */; 433 | } 434 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample.xcodeproj/project.xcworkspace/xcuserdata/yizhon.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/azure-iot-samples-ios/de53db223bf3be2fcc0e00f0e0ccad6e166c0e5f/quickstart/sample-device/MQTT Client Sample.xcodeproj/project.xcworkspace/xcuserdata/yizhon.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample.xcodeproj/xcuserdata/yizhon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MQTT Client Sample.xcscheme 8 | 9 | orderHint 10 | 5 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/azure-iot-samples-ios/de53db223bf3be2fcc0e00f0e0ccad6e166c0e5f/quickstart/sample-device/MQTT Client Sample/.DS_Store -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | import UIKit 5 | 6 | @UIApplicationMain 7 | class AppDelegate: UIResponder, UIApplicationDelegate { 8 | 9 | var window: UIWindow? 10 | 11 | 12 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 13 | // Override point for customization after application launch. 14 | return true 15 | } 16 | 17 | func applicationWillResignActive(_ application: UIApplication) { 18 | // 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. 19 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 20 | } 21 | 22 | func applicationDidEnterBackground(_ application: UIApplication) { 23 | // 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. 24 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 25 | } 26 | 27 | func applicationWillEnterForeground(_ application: UIApplication) { 28 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 29 | } 30 | 31 | func applicationDidBecomeActive(_ application: UIApplication) { 32 | // 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. 33 | } 34 | 35 | func applicationWillTerminate(_ application: UIApplication) { 36 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 37 | } 38 | 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample/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" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample/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 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample/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 | 31 | 38 | 45 | 52 | 59 | 66 | 73 | 80 | 87 | 94 | 101 | 110 | 119 | 126 | 133 | 140 | 147 | 154 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | NSLocationWhenInUseUsageDescription 28 | 29 | NSLocationAlwaysAndWhenInUseUsageDescription 30 | 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /quickstart/sample-device/MQTT Client Sample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | import UIKit 5 | import AzureIoTHubClient 6 | import Foundation 7 | 8 | 9 | class ViewController: UIViewController { 10 | 11 | //Put your connection string here 12 | private let connectionString = "" 13 | 14 | // Select your protocol of choice: MQTT_Protocol, AMQP_Protocol or HTTP_Protocol 15 | // Note: HTTP_Protocol is not currently supported 16 | private let iotProtocol: IOTHUB_CLIENT_TRANSPORT_PROVIDER = MQTT_Protocol 17 | 18 | // IoT hub handle 19 | private var iotHubClientHandle: IOTHUB_CLIENT_LL_HANDLE!; 20 | 21 | override func viewDidLoad() { 22 | super.viewDidLoad() 23 | } 24 | 25 | override func didReceiveMemoryWarning() { 26 | super.didReceiveMemoryWarning() 27 | // Dispose of any resources that can be recreated. 28 | } 29 | // UI elements 30 | @IBOutlet weak var btnStart: UIButton! 31 | @IBOutlet weak var btnStop: UIButton! 32 | @IBOutlet weak var lblSent: UILabel! 33 | @IBOutlet weak var lblGood: UILabel! 34 | @IBOutlet weak var lblBad: UILabel! 35 | @IBOutlet weak var lblRcvd: UILabel! 36 | @IBOutlet weak var lblLastTemp: UILabel! 37 | @IBOutlet weak var lblLastHum: UILabel! 38 | @IBOutlet weak var lblLastRcvd: UILabel! 39 | @IBOutlet weak var lblLastSent: UILabel! 40 | 41 | 42 | 43 | 44 | var cntSent = 0 45 | var cntGood: Int = 0 46 | var cntBad = 0 47 | var cntRcvd = 0 48 | var randomTelem : String! 49 | 50 | // Timers used to control message and polling rates 51 | var timerMsgRate: Timer! 52 | var timerDoWork: Timer! 53 | 54 | /// Increments the messages sent count and updates the UI 55 | func incrementSent() { 56 | cntSent += 1 57 | lblSent.text = String(cntSent) 58 | } 59 | 60 | /// Increments the messages successfully received and updates the UI 61 | func incrementGood() { 62 | cntGood += 1 63 | lblGood.text = String(cntGood) 64 | } 65 | 66 | /// Increments the messages that failed to be transmitted and updates the UI 67 | func incrementBad() { 68 | cntBad += 1 69 | lblBad.text = String(cntBad) 70 | } 71 | 72 | func incrementRcvd() { 73 | cntRcvd += 1 74 | lblRcvd.text = String(cntRcvd) 75 | } 76 | 77 | 78 | func updateTelem() { 79 | let temperature = String(format: "%.2f",drand48() * 15 + 20) 80 | let humidity = String(format: "%.2f", drand48() * 20 + 60) 81 | var data : [String : String] = ["temperature":temperature, 82 | "humidity": humidity] 83 | randomTelem = data.description 84 | lblLastTemp.text = data["temperature"] 85 | lblLastHum.text = data["humidity"] 86 | } 87 | 88 | 89 | 90 | /// Sends a message to the IoT hub 91 | @objc func sendMessage() { 92 | 93 | var messageString: String! 94 | 95 | updateTelem() 96 | 97 | // This the message 98 | messageString = randomTelem 99 | lblLastSent.text = messageString 100 | 101 | 102 | // Construct the message 103 | let messageHandle: IOTHUB_MESSAGE_HANDLE = IoTHubMessage_CreateFromByteArray(messageString, messageString.utf8.count) 104 | 105 | if (messageHandle != OpaquePointer.init(bitPattern: 0)) { 106 | 107 | // Manipulate my self pointer so that the callback can access the class instance 108 | let that = UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque()) 109 | 110 | if (IOTHUB_CLIENT_OK == IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messageHandle, mySendConfirmationCallback, that)) { 111 | incrementSent() 112 | } 113 | } 114 | 115 | // 116 | // IoTHubClient_LL_DoWork(iotHubClientHandle) 117 | } 118 | 119 | /// Check for waiting messages and send any that have been buffered 120 | @objc func dowork() { 121 | IoTHubClient_LL_DoWork(iotHubClientHandle) 122 | } 123 | 124 | /// Display an error message 125 | /// 126 | /// parameter message: The message to display 127 | /// parameter startState: Start button will be set to this state 128 | /// parameter stopState: Stop button will be set to this state 129 | func showError(message: String, startState: Bool, stopState: Bool) { 130 | btnStart.isEnabled = startState 131 | btnStop.isEnabled = stopState 132 | print(message) 133 | } 134 | 135 | // This function will be called when a message confirmation is received 136 | // 137 | // This is a variable that contains a function which causes the code to be out of the class instance's 138 | // scope. In order to interact with the UI class instance address is passed in userContext. It is 139 | // somewhat of a machination to convert the UnsafeMutableRawPointer back to a class instance 140 | let mySendConfirmationCallback: IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK = { result, userContext in 141 | 142 | var mySelf: ViewController = Unmanaged.fromOpaque(userContext!).takeUnretainedValue() 143 | 144 | if (result == IOTHUB_CLIENT_CONFIRMATION_OK) { 145 | mySelf.incrementGood() 146 | } 147 | else { 148 | mySelf.incrementBad() 149 | } 150 | } 151 | 152 | // This function is called when a message is received from the IoT hub. Once again it has to get a 153 | // pointer to the class instance as in the function above. 154 | let myReceiveMessageCallback: IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC = { message, userContext in 155 | 156 | var mySelf: ViewController = Unmanaged.fromOpaque(userContext!).takeUnretainedValue() 157 | 158 | var messageId: String! 159 | var correlationId: String! 160 | var size: Int = 0 161 | var buff: UnsafePointer? 162 | var messageString: String = "" 163 | 164 | messageId = String(describing: IoTHubMessage_GetMessageId(message)) 165 | correlationId = String(describing: IoTHubMessage_GetCorrelationId(message)) 166 | 167 | if (messageId == nil) { 168 | messageId = "" 169 | } 170 | 171 | if correlationId == nil { 172 | correlationId = "" 173 | } 174 | 175 | mySelf.incrementRcvd() 176 | 177 | // Get the data from the message 178 | var rc: IOTHUB_MESSAGE_RESULT = IoTHubMessage_GetByteArray(message, &buff, &size) 179 | 180 | if rc == IOTHUB_MESSAGE_OK { 181 | // Print data in hex 182 | for i in 0 ..< size { 183 | let out = String(buff![i], radix: 16) 184 | print("0x" + out, terminator: " ") 185 | } 186 | 187 | print() 188 | 189 | // This assumes the received message is a string 190 | let data = Data(bytes: buff!, count: size) 191 | messageString = String.init(data: data, encoding: String.Encoding.utf8)! 192 | 193 | print("Message Id:", messageId, " Correlation Id:", correlationId) 194 | print("Message:", messageString) 195 | mySelf.lblLastRcvd.text = messageString 196 | } 197 | else { 198 | print("Failed to acquire message data") 199 | mySelf.lblLastRcvd.text = "Failed to acquire message data" 200 | } 201 | return IOTHUBMESSAGE_ACCEPTED 202 | } 203 | 204 | /// Called when the start button is clicked on the UI. Starts sending messages. 205 | /// 206 | /// - parameter sender: The clicked button 207 | @IBAction func startSend(sender: UIButton!) { 208 | 209 | // Dialog box to show action received 210 | btnStart.isEnabled = false 211 | btnStop.isEnabled = true 212 | cntSent = 0 213 | lblSent.text = String(cntSent) 214 | cntGood = 0 215 | lblGood.text = String(cntGood) 216 | cntBad = 0 217 | lblBad.text = String(cntBad) 218 | 219 | // Create the client handle 220 | iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, iotProtocol) 221 | 222 | if (iotHubClientHandle == nil) { 223 | showError(message: "Failed to create IoT handle", startState: true, stopState: false) 224 | 225 | return 226 | } 227 | 228 | // Mangle my self pointer in order to pass it as an UnsafeMutableRawPointer 229 | let that = UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque()) 230 | 231 | // Set up the message callback 232 | if (IOTHUB_CLIENT_OK != (IoTHubClient_LL_SetMessageCallback(iotHubClientHandle, myReceiveMessageCallback, that))) { 233 | showError(message: "Failed to establish received message callback", startState: true, stopState: false) 234 | 235 | return 236 | } 237 | 238 | // Timer for message sends and timer for message polls 239 | timerMsgRate = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(sendMessage), userInfo: nil, repeats: true) 240 | timerDoWork = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(dowork), userInfo: nil, repeats: true) 241 | } 242 | 243 | /// Called when the stop button is clicked on the UI. Stops sending messages and cleans up. 244 | /// 245 | /// - parameter sender: The clicked button 246 | @IBAction public func stopSend(sender: UIButton!) { 247 | 248 | timerMsgRate?.invalidate() 249 | timerDoWork?.invalidate() 250 | IoTHubClient_LL_Destroy(iotHubClientHandle) 251 | btnStart.isEnabled = true 252 | btnStop.isEnabled = false 253 | } 254 | } 255 | 256 | -------------------------------------------------------------------------------- /quickstart/sample-device/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | 3 | platform :ios, '9.0' 4 | 5 | workspace 'MQTT Client Sample' 6 | 7 | target 'MQTT Client Sample' do 8 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 9 | use_frameworks! 10 | 11 | # Pods for MQTT Client Sample 12 | pod 'AzureIoTUtility', '=1.5.0' 13 | pod 'AzureIoTuMqtt', '=1.5.0' 14 | pod 'AzureIoTuAmqp', '=1.5.0' 15 | pod 'AzureIoTHubClient', '=1.5.0' 16 | pod 'OpenSSL-Universal' 17 | end 18 | --------------------------------------------------------------------------------