Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Domenachi

macrumors newbie
Original poster
Jul 26, 2013
6
0
I've read a few books on Xcode, watched a lot of great videos now on Swift and done of ton of example projects throughout all these. I feel like I'm on the early side of intermediate in terms of understanding.

I'd like to make a basic app that can track packages (like UPS and Fedex) and I really just need someone to point me in the right direction, because when I'm looking around I see that like UPS, Fedex, etc have programs where you sign up as a developer and get to use these API's that do a whole lot more than I really want to do.

Is that the only way to go about this - or instead, should I be looking into an easier way? Is something like this possible?:

  • Compare string entered to figure out what shipping service this tracking number is from
  • Add that tracking number onto an URL however it needs to be to return a web page with the tracking information in there somewhere
  • Parse out just the part where it says the status of the shipment so I can display that to the user

Thanks for any advice on this - even just "hey newb, google NSURL"...you know, whatever you got. ty ty
 
You might want to look at the OS/X JuneCloud Delivery Status widget which works great tracking UPS, USPS, FedX and other shipments ....
 
What you are describing as your main problems (e.g. "return a web page with the tracking information in there somewhere") are the reasons you should be using their API's.

Effectively you are describing a technique usually referred to as 'scraping' and is only used if there are NOT provided API's to attain the information. Scraping is very fragile. For example, a relatively minor change on Fedex's website will break your application, and there is no need for Fedex to notify you that such a change is coming. (page structure, url structure, security features like form tokens, just to name a few)

I would urge you to go ahead and learn how to consume Fedex and UPS's SOAP API's, you will learn a lot that can be expanded to any SOAP API, and then to just any web API in general.

If insist in scraping. I suggest you either look at boning up on regex, or building an XML/DOM you can query/navigate through.
 
Jared, can you please help me with a few keywords to research on both ends of this. I've registered with UPS and downloaded their API. I just don't really understand which directions to go on the 2 sides of this communication (UPS's API and Objective-C's related functions.

In the developers download from UPS there are 3 "Developers guides" -> "Tracking HTML", "Tracking Web Services" and "Tracking XML". Maybe a good example of what would really help me is something like:

"XML is definitely the way to go - just use that guide on the UPS side. Then on the Objective-C, read more about NSURL - you'll be using NSURL, NSURLRequest, NSURLResponse, NSURLConnection(?)."

The code samples they have in this API are in JAXB, PERL, and PHP (so I guess those aren't for me) but they also have a "Sample Requests and Responses" folder with "Track_SampleRequest.xml" and "Track_SampleRequest.xml". Those files look pretty straight forward with places to enter my license number, userid and password and tracking number. That seems like maybe the way to go.

But then there's also this "Tracking Web Services" folder that has code samples for Axis2.4, DotNet, JAXWS2.1, PERL, and PHP. So maybe my first choice is pick between "Tracking Web Services" and "Tracking XML Tools"...

Sure appreciate the help...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.