Wrox Programmer Forums
|
BOOK: Professional iOS Network Programming: Connecting the Enterprise to the iPhone and iPad
This is the forum to discuss the Wrox book Professional iOS Network Programming: Connecting the Enterprise to the iPhone and iPad by Jack Cox, Nathan Jones, John Szumski; ISBN: 978-1-118-36240-2
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional iOS Network Programming: Connecting the Enterprise to the iPhone and iPad section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2012, 09:17 AM
Registered User
 
Join Date: Nov 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with Chapter 6

Problems with getting the mobile banking app to work. I'm not a website person, so I loaded the index.php into the default folder on Mountain Lion Server. I changed your.banking.com to my ip address of the server. I also changed kResourceBaseURL to "https://192.168.1.114". It always just give me an unsecure connection. The challenge is always cancelled. Any ideas? Thanks.
 
Old November 6th, 2012, 11:02 AM
Wrox Author
 
Join Date: Oct 2012
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey jlchapman - first, thanks for buying the book. I'd be happy to help you get started with chapter 6. Which operation are you trying to execute, the initial authenticate?

First, a couple things to check on the server, have you dropped the .htaccess file into the directory and ensured that is working by attempting to hit an endpoint - e.g. POSTing to https://192.168.1.114/path/to/index/authenticate/basic?

If that is up and running, the next thing to check are the domains in the validProtectionSpaces method in Model.m. If the authenticate method is failing you could also put a breakpoint at line 203 in the AuthenticateOperation.m file.

Let me know if that doesn't resolve the issue.
 
Old November 7th, 2012, 08:47 PM
Registered User
 
Join Date: Nov 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nathan, Thanks for replying. Due to my work load, I wont be able to get back to this problem until Friday.

Thanks, Jerry
 
Old November 7th, 2012, 10:22 PM
Wrox Author
 
Join Date: Oct 2012
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Definitely Jerry. Just post back here if you continue to have issues after you review and we'll get things sorted out.

Nate
 
Old November 9th, 2012, 08:09 PM
Registered User
 
Join Date: Nov 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Nathan,

I'm a newby when it comes to websites and php.
I compiled the code and downloaded to my iPhone 5, no changes except as noted below.
I have the .htaccess file in the default directory with index.php and utils.php
<Directory"/Library/WebServer/Documents">section and change to AllowOverride All so that .htaccess files will work.
I also restarted apache.
In Safari I tried http://192.168.1.114/index/authenticate/basic
OR http://192.168.1.114/index.php
it returned {"result":"ERROR","additional_info":"Invalid request. You are not authorized. Token is invalid."}

#define kResourceBaseURL @"http://192.168.1.114"
I'm using username = 'user' password = 'basic'
In authenticateOperation.m I added a nslog after the following in start method
url = [kResourceBaseURL stringByAppendingString:kEndpoint];
NSLog(@"url = %@",url);
output is url = http://192.168.1.114/user/authenticate

I get the alert showing 'Login Failed' invalid username or password when trying to login.

Hope this helps, Jerry
 
Old November 18th, 2012, 10:40 PM
Wrox Author
 
Join Date: Oct 2012
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Jerry - first, sorry it took so long to get back to you.

Ok, let's check a few things.
1) I'm assuming the cert you're using is self-signed, is that accurate? If so, the likely culprit is that Apple doesn't trust it and thus you're failing the underlying NSURLConnection security checks. You should add the certificate to your device - easiest way is to email it to yourself and install the cert.
2) I noticed a couple differences in the url's you listed above. The one you hit in your browser was */index/authenticate/basic and the one in the app was */user/authenticate. You should be hitting */user/authenticate.
3) Did you update the values in the method validProtectionSpaces to match your address? Try setting a breakpoint (or logging something) in the connection:willSendRequestForAuthenticationChallen ge: method (line 204) in the AuthenticateOperation implementation
4) Also, have you tried hitting your service with a web service test client like HTTP Client (in the mac appstore) or a chrome plugin like https://chrome.google.com/webstore/d...jhfbgofnpcjmb? If not, try that and see what the result is. We're just trying to narrow down where it's failing.

Let me know how things go. I will keep an eye on it this week.
 
Old October 6th, 2014, 05:20 AM
Registered User
 
Join Date: Oct 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Nathan, could you please post a brief instructions on how to install the server tier?

Server tier installation on your Chapter 6 sample app?

Thanks a lot,
James
 
Old October 7th, 2014, 09:47 PM
Wrox Author
 
Join Date: Oct 2012
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Services

Hey James - thanks for the note, but I'm not totally sure what you need. Chapter 6 contains a series of PHP scripts. Have you tried deploying the scripts to a PHP enabled server? If this is for development testing purposes, localhost or even a shared host should suffice.

Hope that helps,
Nate
 
Old October 8th, 2014, 04:10 PM
Registered User
 
Join Date: Oct 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you could post brief instruction on "deploying the scripts to a PHP enabled local host on Mac", that will save readers lots of hours.

Thanks, James


Quote:
Originally Posted by nathanhjones View Post
Hey James - thanks for the note, but I'm not totally sure what you need. Chapter 6 contains a series of PHP scripts. Have you tried deploying the scripts to a PHP enabled server? If this is for development testing purposes, localhost or even a shared host should suffice.

Hope that helps,
Nate
 
Old October 30th, 2014, 02:59 AM
Registered User
 
Join Date: Oct 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

on page 149
LISTING 6-20: Handling AES Encrypted Responses (/App/Mobile-Banking/ GetAccountsOperation.m)

Your code made MAC validation
Code:
 if ([inboundMAC isEqualToString:generatedMAC]) { ...
after
Code:
 calling decryptedWithAESUsingKey:kAESEncryptionKey andIV:ivData];
I think the order should be opposite? because if MACs don't match, game is over, NO expensive decryptions should ever perform...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 - problems kent1975 BOOK: Beginning ASP.NET 4 : in C# and VB 5 January 16th, 2011 09:28 AM
Problems with chapter 1 macuser BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 2 April 2nd, 2009 12:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.