Objective-C and Opening files in your iOS application from mail

Screen Shot 2013-12-21 at 8.46.11 AMI have been coding on my iMac for a bit now to learn objective-c (which I am seriously still a newb at, it’s like me writing a term paper in German). Well, anyway, I have started to gather some tips that took me a while to figure out so I figured I would share my findings. Since I am using xCode 5.x most of the search results are pre version 5 and don’t help a lot. Google and the iOS developer library have been invaluable along with all of the sample applications. So if you read anything I could do easier/better please let me know.

The first part of accepting files in your iOS application is registering the file types you are wanting to open within your application. This allows your application to show up in the open dialog when you hold down on an attachment in an application like mail:

IMG_3972

 

This was a little bit of a challenge because the new UI in xCode 5 does a lot of this for you. You no longer have to edit XML, you can just use the properties dialog to register for the file type. Here is what I did to register my application to open ZIP files:

Screen Shot 2013-12-20 at 1.11.11 PM

 

You can get a full list of supported System-Declared Uniform Type Identifiers here. Once you figure out what files your application will use, the next step is to code the retrieval of that file in your application.

Like any newb, I learned a lot of things the hard way – I should have probably bought a book but I figured I would struggle through it because I learn better. What I found out is the iOS sets up its file system in a sandbox manner. Meaning applications have their own “space” in the storage device. It is setup very similar to user directories in Linux. Each application

private/var/mobile/Applications//xxxxxx

When you gesture to open a file with your application it is actually copied to the Documents/Inbox directory under your . So one lesson I learned is to clean this puppy out after processing the file because, for instance, if you keep opening the file my-archive.zip it actually keeps getting copied to the Inbox folder and you could have a situation where you keep storing new copies:

my-archive.zip
my-archive-1.zip
my-archive-2.zip
my-archive-3.zip
etc

After debugging a little I noticed that while testing my application I ended up taking up over 300MB of space with many copies of the file. This is basically a “memory leak” if the application does not delete these files appropriately.

 

 

This is a voice dictated blog post

dictationI am using my Mac voice recognition to type this blog post. While I think this technology is pretty cool, correcting mistakes still requires the mouse and keyboard. I am very surprised the technology works with my voice with no training. So far I have spoken this blog post with no mistakes. I am not sure if I would ever use this going forward for writing blog posts but I do think it is interesting. I am not using A plug-in microphone, I am using the built-in microphone in the iMac monitor. If this actually allowed you to do correction I think the technology would be much more valuable.

You can also do things like:-) or even a:-(.

Punctuation, Typography, capitalization, and currency symbols are well supported.

You can even do intellectual property signs like the ©,®,™.

I can even format a number. Four instance 2342.

In the end I think this is pretty cool.

<<end of dictation>>

To learn more about voice dictation on your Mac you can check out this article which gives you all of the commands supported.

 

My favorite OS X Mavericks feature!

Screen Shot 2013-10-29 at 8.18.40 AMI did this all the time mixing Google Maps and sending the address to my phone – which I always thought how dumb that was considering everything else was synchronized so nicely between my Mac and iPhone. The new feature in OS X Mavericks lets you find the location and route on your Mac and send it to your device. This is also very cool because my wife and I share the same Apple account and now I can easily send her directions!

Continue reading

Debug JavaScript and HTML in a UIWebView on an iOS Device

Screen Shot 2013-10-10 at 12.33.29 PMI got my first Mac over the summer and have been playing around writing applications for iPhone and iPad. Being very new to the Mac I am constantly using Google to find tips, tricks, and “how to” articles. And of course when I find something very cool and easy to do I like to share it. This is my first quick tip for developing embedded HTML applications in an iOS device. Without a debugger you are dead in the water!

I am interested to hear if this the best way to debug such applications, any feedback is welcome.

Technology at its best – ‘This guy has my MacBook!’

The power of technology, the internet and social software is stunning.

It all started after Kaufman discovered the burglary and filed a report with the Oakland police. Then he began to gather information about his stolen MacBook using theft-tracking software called Hidden, which uses the laptop’s webcam and other tools to surreptitiously capture photos and screen shots of the computer in use.

‘This guy has my MacBook!’ Blog, tweets help recover stolen computer – CNN.com.

Mac and Linux update on the Attachment Viewer 2.0 for Lotus Notes

After getting some feedback from the prior post (thanks everyone), I will need to move the Microsoft Office Viewer code into an Eclipse fragment. This will allow me (and maybe others) to write a Mac and Linux (good luck there) version for the Office files by creating additional fragments. If you haven’t seen the video please watch it and if you like it then make sure you give me a thumbs up on YouTube!

Closing the Dev/debug on Mac poll at the end of the day

I never know how long a poll should be open so I was thinking of announcing the closing of the poll to give it more attention.  I will be closing this poll at the end of the day today (Eastern Standard Time) so if you haven’t voted please do. 🙂

[poll id=”6″]