Developing iPhone and iPad apps that leverage Windows Azure
- 2. Developing iPhone and iPad apps that Leverage Windows AzureSimon GuestDirector, Mobility SolutionsNeudesic, LLCsimon.guest@neudesic.com
- 22. REST request for listing all containersREST Endpoint:http://[account].blob.core.windows.netGET http://iostest.blob.core.windows.net/?comp=list&include=metadatax-ms-date: Thu, 14 Apr 2011 20:30:00 GMTx-ms-version: 2009-09-19x-ms-blob-type: BlockBlobAuthorization: SharedKeyiostest:[ComputedHash]Blob Storage
- 23. …but how do I get that computed hash?REST Endpoint:http://[account].blob.core.windows.netTo calculate the computed hash:AccountKey: /9seXadQ9HwOpXUO1jKxFN8q…Request: GETx-ms-blob-type:BlockBlobx-ms-date:Thu, 14 Apr 2011 20:30:00 GMTx-ms-version:2009-09-19/iostest/comp:listinclude:metadataHash = HMACSHA256(UTF8Encode(Request), Base64Decode(AccountKey))Blob StorageAccount Key: /9seXadQ9HwOpXUO1jKxFN8q…
- 24. Making the callGET http://iostest.blob.core.windows.net/?comp=list&include=metadatax-ms-date: Thu, 14 Apr 2011 20:30:00 GMTx-ms-version: 2009-09-19x-ms-blob-type: BlockBlobAuthorization: SharedKeyiostest:[ComputedHash]<?xml version="1.0" encoding="utf-8"?><EnumerationResultsAccountName="http://myaccount.blob.core.windows.net/"> <Prefix>c</Prefix> <MaxResults>3</MaxResults> <Containers> <Container> <Name>container1</Name> <Url>http://iostest.blob.core.windows.net/photos</Url> <Properties> <Last-Modified>Sun, 14 Apr 2011 20:09:03 GMT</Last-Modified> </Properties> </Container> </Containers>REST Endpoint:http://[account].blob.core.windows.netBlob Storage
- 25. REST request (PUT) for adding a new photoREST Endpoint:http://[account].blob.core.windows.netPUT http://iostest.blob.core.windows.net/photos/party.jpgx-ms-date: Thu, 14 Apr 2011 20:30:00 GMTx-ms-version: 2009-09-19x-ms-blob-type: BlockBlobAuthorization: SharedKeyiostest:[ComputedHash]{...binary representation of photo...}Blob Storage
- 29. REST request for listing all tablesREST Endpoint:http://[account].table.core.windows.netList, Create, and Delete Tables
- 30. List, Put, Get, Delete Table EntitiesGET http://iostest.blob.core.windows.net/Tablesx-ms-date: Thu, 14 Apr 2011 20:30:00 GMTx-ms-version: 2009-09-19DataServiceVersion: 1.0;NetFxMaxDataServiceVersion: 2.0;NetFxAuthorization: SharedKeyiostest:[ComputedHash]<feed xml:base="http://iostest.tables.core.windows.net/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <title type="text">Tables</title> <id>http://iostest.tables.core.windows.net/Tables</id> <updated>2011-04-04T17:18:54.7062347Z</updated> <link rel="self" title="Tables" href="Tables" /> <entry> <id>http://myaccount.tables.core.windows.net/Tables(’photodata')</id> <title type="text"></title> <updated>2009-01-04T17:18:54.7062347Z</updated> <author> <name /> </author> <link rel="edit" title="Tables" href="Tables(’photodata')" /> <m:properties> <d:TableName>photodata</d:TableName> </m:properties> </content> </entry></feed>photodataTable Storage
- 31. REST request for inserting an entityREST Endpoint:http://[account].table.core.windows.netList, Create, and Delete Tables
- 32. List, Put, Get, Delete Table EntitiesPUT http://iostest.blob.core.windows.net/Tablesx-ms-date: Thu, 14 Apr 2011 20:30:00 GMTx-ms-version: 2009-09-19DataServiceVersion: 1.0;NetFxMaxDataServiceVersion: 2.0;NetFxAuthorization: SharedKeyiostest:[ComputedHash]<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <title /> <updated>2011-04-10T23:46:19.3857256Z<updated/> <author> <name /> </author> <id /> <content type="application/xml"> <m:properties><d:Description>My coworker is drunk</d:Description> <d:DrinkCountm:type="Edm.Int32”>10</d:DrinkCount></m:properties> </content></entry>photodataTable Storage
- 41. Scenario 1 - TakeawaysRecommendations:Use blob storage for images, videos, audio
- 43. Wrap REST calls in libraryWatch out for:Blob storage doesn’t offer hierarchical structure
- 47. User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)HTTP RequestHTTP ResponsePagesWindows 7 / IE8.0Web Role
- 48. UserAgent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5HTTP RequestHTTP ResponsePagesWeb RoleiPhone OS 4.3.1
- 49. Mozilla/5.0 (iPad; U; CPU OS 4_3_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.3.1 Mobile/7B334b Safari/531.21.10HTTP RequestHTTP ResponsePagesWeb RoleiPad OS 4.3.1
- 50. if (useragentcontains ”MSIE”)User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0Pagesif (useragentcontains ”iPhone”)Web RoleUserAgent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5PagesiPhone OS 4.3.1
- 51. if (useragent contains ”MSIE”)User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)if (Response.Headers[“User-Agent”].Contains(“iPhone”)){return View(“iPhone”);}if (Response.Headers[“User-Agent”].Contains(“iPad”)){return View(“iPad”);}if (Response.Headers[“User-Agent].Contains...Windows 7 / IE8.0ViewCSSControllerif (useragentcontains”iPhone”)Web RoleASP.NETMVCViewEngineUserAgent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5ViewCSSiPhone OS 4.3.1
- 54. if (useragent contains ”MSIE”)User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerif (useragentcontains”iPhone”)Web RoleASP.NETMVCViewEngineUserAgent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5ViewCSSiPhone OS 4.3.1
- 56. if (useragent contains ”MSIE”)User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerif (useragentcontains”iPhone”)Web RoleASP.NETMVCViewEngineUserAgent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5ViewCSSiPhone OS 4.3.1
- 58. Accessing the Camera?Local storage?“Looking good! But this is still a mobile web app. How about…”Getting location via GPS?Uploading to the AppStore?
- 60. WebViewControllerNative shell upload to AppStoreif (useragent contains ”MSIE”)JavaScript bridgeViewCSSControlleriPhone OS 4.3.1Native Libraries (ObjC)if (useragentcontains”iPhone”)Web RoleASP.NETMVCViewEngineViewCSSWeb StorageLocal HTML
- 62. Scenario 2 - TakeawaysRecommendations:Mobile Web sites let you target multiple devices
- 64. Hybrid approach with PhoneGapWatch out for:Many different UI frameworks – choose carefully, think about longevity3
- 67. Token LengthPayload LengthJSON formattedAppRegistrationSend Message Payload0032deviceToken034messageApple Push Notification Servicegateway.sandbox.push.apple.comNative ApplicationAzure Role optimized for backgroundtasksWorker RoleiPad/iPhone OS 4.3.1User Acceptance
- 69. AppRegistrationSend Message PayloadApple Push Notification Servicegateway.sandbox.push.apple.comNative ApplicationWorker RoleRequestChangedSessionDetailsWindows Azure QueueiPad/iPhone OS 4.3.1Web RoleSessionUpdatedthrough WebUser AcceptanceUpdate QueueReceive Message, LaunchApp
- 71. Scenario 3 - TakeawaysRecommendations:APN useful for updating users of events
- 73. Can also be used with PhoneGap shellWatch out for:Use Worker Role to maintain persistent connection to APN (to prevent DOS)ConclusionHistorically not much interaction between iOS and Windows Azure
- 74. ConclusionHistorically not much interaction between iOS and Windows Azure321Use Cloud for StorageReceive NotificationsAccess ApplicationsPossibilities for building iPhone/iPad apps that leverage Windows Azure
- 75. Simon GuestDirector, Mobility Solutionssimon.guest@neudesic.com© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Editor's Notes
- http://stutteringhub.com/wp-content/uploads/2008/07/iStock_000003749151Small1.jpg
- http://www.independent.co.uk/multimedia/dynamic/00514/26-boring-3_514784s.jpg
- http://gizmologia.com/tag/mix08
- http://stutteringhub.com/wp-content/uploads/2008/07/iStock_000003749151Small1.jpg
- http://stutteringhub.com/wp-content/uploads/2008/07/iStock_000003749151Small1.jpg
- http://daily.likeme.net/lm/wp-content/uploads/2010/04/Four-Beers-in-One.jpg
- http://www.freemages.co.uk/album/etats_unis/las_vegas_mandalay_bay.jpghttp://www.globalnerdy.com/wordpress/wp-content/uploads/2011/01/mix10-keynote.jpg
- http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2011/3/17/1300366092912/A-Japanese-Self-Defence-F-011.jpg
- http://www.abc.net.au/reslib/201103/r733146_5928731.jpg
- http://s3.amazonaws.com/data.tumblr.com/tumblr_li2196MvwQ1qcokc4o1_1280.jpg?AWSAccessKeyId=AKIAJ6IHWSU3BX3X7X3Q&Expires=1302807999&Signature=jcCDELbr6UQ%2BK00VMYEqw7SP1Rc%3D