Skip to content
Browse files

Merge pull request #447 from mollybostic/weekly_1009

fix merge conflict #438
  • Loading branch information...
2 parents f7ca057 + 0e336b0 commit 5eed22591ec0adec424ef57d0f7daaca0d96517c @scottturnbull scottturnbull committed
View
2 DevCenter/Mobile/Tutorials/mobile-services-get-started-ios.md
@@ -16,7 +16,7 @@ A screenshot from the completed app is below:
![][0]
-Completing this guide is a prerequisite for all other Mobile Services tutorials for iOS apps.
+Completing this tutorial requires XCode 4.5 and iOS 5.0 or later versions.
<div class="dev-callout"><strong>Note</strong> <p>To complete this tutorial, you need a Windows Azure account that has the Windows Azure Mobile Services feature enabled.</p> <ul> <li>If you don't have an account, you can create a free trial account in just a couple of minutes. For details, see <a href="http://www.windowsazure.com/en-us/pricing/free-trial/?WT.mc_id=A0E0E5C02" target="_blank">Windows Azure Free Trial</a>.</li> <li>If you have an existing account but need to enable the Windows Azure Mobile Services preview, see <a href="../create-a-windows-azure-account/#enable" target="_blank">Enable Windows Azure preview features</a>.</li> </ul> </div>
View
31 DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md
@@ -26,7 +26,7 @@ This tutorial walks you through these basic steps:
4. [Update the app to use Mobile Services]
5. [Test the app against Mobile Services]
-This tutorial requires the [Mobile Services iOS SDK] and [XCode 4.5][Install Xcode] or a later version.
+This tutorial requires the [Mobile Services iOS SDK] and [XCode 4.5][Install Xcode] and iOS 5.0 or later versions.
<h2><a name="download-app"></a><span class="short-header">Download the project</span>Download the GetStartedWithData project</h2>
@@ -148,27 +148,27 @@ Now that your mobile service is ready, you can update the app to store items in
This creates a property representation for your mobile services table.
-6. In the Management Portal, click **Mobile Services**, and then click the mobile service you just created.
+5. In the Management Portal, click **Mobile Services**, and then click the mobile service you just created.
-7. Click the **Dashboard** tab and make a note of the **Site URL**, then click **Manage keys** and make a note of the **Application key**.
+6. Click the **Dashboard** tab and make a note of the **Site URL**, then click **Manage keys** and make a note of the **Application key**.
![][8]
You will need these values when accessing the mobile service from your app code.
-8. Back in Xcode, open TodoService.m and locate the following commented line of code:
+7. Back in Xcode, open TodoService.m and locate the following commented line of code:
// Initialize the Mobile Service client with your URL and key.
After this comment, add the following line of code:
- self.client = [MSClient clientWithApplicationURLString:@APPURL withApplicationKey:@"APPKEY"];
+ self.client = [MSClient clientWithApplicationURLString:@"APPURL" withApplicationKey:@"APPKEY"];
This creates an instance of the Mobile Services client.
-9. Replace the values of **APPURL** and **APPKEY** in this code with the URL and application key from the mobile service that you acquired in step 6.
+8. Replace the values of **APPURL** and **APPKEY** in this code with the URL and application key from the mobile service that you acquired in step 6.
-10. Locate the following commented line of code:
+9. Locate the following commented line of code:
// Create an MSTable instance to allow us to work with the TodoItem table.
@@ -178,7 +178,7 @@ Now that your mobile service is ready, you can update the app to store items in
This creates the TodoItem table instance.
-11. Locate the following commented line of code:
+10. Locate the following commented line of code:
// Create a predicate that finds items where complete is false comment in the refreshDataOnSuccess method.
@@ -188,7 +188,7 @@ Now that your mobile service is ready, you can update the app to store items in
This creates a query to return all tasks that have not yet been completed.
-12. Locate the following commented line of code:
+11. Locate the following commented line of code:
// Query the TodoItem table and update the items property with the results from the service.
@@ -201,6 +201,19 @@ Now that your mobile service is ready, you can update the app to store items in
completion();
}];
+12. Locate the **addItem** method, and replace the body of the method with the following code:
+
+ // Insert the item into the TodoItem table and add to the items array on completion
+ [self.table insert:item completion:^(NSDictionary *result, NSError *error) {
+ NSUInteger index = [items count];
+ [(NSMutableArray *)items insertObject:item atIndex:index];
+
+ // Let the caller know that we finished
+ completion(index);
+ }];
+
+ This code sends an insert request to the mobile service.
+
13. Locate the **completeItem** method, and replace the body of the method with the following code:
// Update the item in the TodoItem table and remove from the items array on completion
View
31 DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md
@@ -21,7 +21,7 @@ This tutorial walks you through these basic steps to enable authentication in yo
This tutorial is based on the Mobile Services quickstart. You must also first complete the tutorial [Get started with Mobile Services].
<div class="dev-callout"><b>Note</b>
- <p>This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic <a href="/en-us/develop/mobile/tutorials/single-sign-on-win8-dotnet">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
+ <p>This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic <a href="/en-us/develop/mobile/tutorials/single-sign-on-windows-8-dotnet">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
</div>
<h2><a name="register"></a><span class="short-header">Register your app</span>Register your app for authentication and configure Mobile Services</h2>
@@ -82,28 +82,23 @@ Next, you will update the app to authenticate users before requesting resources
{
while (user == null)
{
-
- user = await App.MobileService
- .LoginAsync(
- MobileServiceAuthenticationProvider.Facebook);
- if (user.UserId != null)
+ string message;
+ try
{
-
- var message =
+ user = await App.MobileService
+ .LoginAsync(MobileServiceAuthenticationProvider.Facebook);
+ message =
string.Format("You are now logged in - {0}", user.UserId);
- var dialog = new MessageDialog(message);
- dialog.Commands.Add(new UICommand("OK"));
- await dialog.ShowAsync();
}
- else
+ catch (InvalidOperationException)
{
- user = null;
- var dialog =
- new MessageDialog("You must log in.", "Login Required");
- dialog.Commands.Add(new UICommand("OK"));
- await dialog.ShowAsync();
+ message = "You must log in. Login Required";
}
- }
+
+ var dialog = new MessageDialog(message);
+ dialog.Commands.Add(new UICommand("OK"));
+ await dialog.ShowAsync();
+ }
}
This creates a member variable for storing the current user and a method to handle the authentication process. The user is authenticated by using a Facebook login.
View
18 DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md
@@ -22,6 +22,8 @@ This tutorial walks you through these basic steps to enable authentication in yo
This tutorial is based on the Mobile Services quickstart. You must also first complete the tutorial [Get started with Mobile Services].
+Completing this tutorial requires XCode 4.5 and iOS 5.0 or later versions.
+
<!--<div class="dev-callout"><b>Note</b>
<p>This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic <a href="/en-us/develop/mobile/tutorials/single-sign-on-win8-dotnet">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
</div>-->
@@ -73,21 +75,13 @@ Next, you will update the app to authenticate users before requesting resources
<h2><a name="add-authentication"></a><span class="short-header">Add authentication</span>Add authentication to the app</h2>
-5. Open the project file TodoListController.m and in the **@interface TodoListController** declaration block, add the following code:
-
- @property (strong, nonatomic) TodoService *todoService;
-
-6. In the **@interface TodoListController** declaration block, add the following code:
-
- @synthesize todoService;
-
-7. In the **viewDidLoad** method, remove the following code that reloads the data into the table:
+1. Open the project file TodoListController.m and in the **viewDidLoad** method, remove the following code that reloads the data into the table:
[todoService refreshDataOnSuccess:^{
[self.tableView reloadData];
}];
-7. Just after the **viewDidLoad** method, add the following code:
+2. Just after the **viewDidLoad** method, add the following code:
- (void)viewDidAppear:(BOOL)animated
{
@@ -131,11 +125,11 @@ Next, you will update the app to authenticate users before requesting resources
<p>If you are using an identity provider other than Facebook, change the value passed to <strong>loginViewControllerWithProvider</strong> above to one of the following: <i>microsoftaccount</i>, <i>facebook</i>, <i>twitter</i>, or <i>google</i>.</p>
</div>
-9. Press the **Run** button to build the project, start the app in the iPhone emulator, then log-on with your chosen identity provider.
+3. Press the **Run** button to build the project, start the app in the iPhone emulator, then log-on with your chosen identity provider.
When you are successfully logged-in, the app should run without errors, and you should be able to query Mobile Services and make updates to data.
-## <a name="next-steps"> </a>Next steps
+## <a name="next-steps"></a>Next steps
In the next tutorial, [Authorize users with scripts], you will take the user ID value provided by Mobile Services based on an authenticated user and use it to filter the data returned by Mobile Services.
View
20 DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-js.md
@@ -21,7 +21,7 @@ This tutorial walks you through these basic steps to enable authentication in yo
This tutorial is based on the Mobile Services quickstart. You must also first complete the tutorial [Get started with Mobile Services].
<div class="dev-callout"><b>Note</b>
- <p>This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic <a href="/en-us/develop/mobile/tutorials/single-sign-on-win8-js">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
+ <p>This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic <a href="/en-us/develop/mobile/tutorials/single-sign-on-windows-8-js">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
</div>
<h2><a name="register"></a><span class="short-header">Register your app</span>Register your app for authentication and configure Mobile Services</h2>
@@ -71,26 +71,14 @@ Next, you will update the app to authenticate users before requesting resources
<h2><a name="add-authentication"></a><span class="short-header">Add authentication</span>Add authentication to the app</h2>
-1. Open the default.html project file and add the following &lt;script&gt; element in the &lt;head&gt; element.
-
- <script src="///LiveSDKHTML/js/wl.js"></script>
-
- This enables Microsoft IntelliSense in the default.html file.
-
-5. Open the project file default.js and add the following comment to the top of the file.
-
- /// <reference path="///LiveSDKHTML/js/wl.js" />
-
- This enables Microsoft IntelliSense in the default.js file.
-
-5. In the **app.OnActivated** method overload, replace the call to the **refreshTodoItems** method with the following code:
+1. Open the project file default.js and in the **app.OnActivated** method overload, replace the call to the **refreshTodoItems** method with the following code:
var userId = null;
// Request authentication from Mobile Services using a Facebook login.
var login = function () {
return new WinJS.Promise(function (complete) {
- client.login("facebook").done(function (results) {;
+ mobileService.login("facebook").done(function (results) {;
userId = results.userId;
refreshTodoItems();
var message = "You are now logged in as: " + userId;
@@ -107,7 +95,7 @@ Next, you will update the app to authenticate users before requesting resources
var authenticate = function () {
login().then(function () {
- if (user === null) {
+ if (userId === null) {
// Authentication failed, try again.
authenticate();
View
2 DevCenter/Mobile/Tutorials/mobile-services-get-started.md
@@ -23,7 +23,7 @@ A screenshot from the completed app is below:
![][0]
-Completing this guide is a prerequisite for all other Mobile Services tutorials for Windows Store apps.
+Completing this tutorial is a prerequisite for all other Mobile Services tutorials for Windows Store apps.
<div class="dev-callout"><strong>Note</strong> <p>To complete this tutorial, you need a Windows Azure account that has the Windows Azure Mobile Services feature enabled.</p> <ul> <li>If you don't have an account, you can create a free trial account in just a couple of minutes. For details, see <a href="http://www.windowsazure.com/en-us/pricing/free-trial/?WT.mc_id=A0E0E5C02" target="_blank">Windows Azure Free Trial</a>.</li> <li>If you have an existing account but need to enable the Windows Azure Mobile Services preview, see <a href="../create-a-windows-azure-account/#enable" target="_blank">Enable Windows Azure preview features</a>.</li> </ul> </div>

0 comments on commit 5eed225

Please sign in to comment.
Something went wrong with that request. Please try again.