Related Posts Plugin for WordPress, Blogger...
This form does not yet contain any fields.

    Follow Me on Pinterest

    Our products are on iTunes!

     Nanaimo Studio

    Find us on Google+ 

     

    We are listed on: Dmegs Link Directory

    Blog Index
    404 page

    Entries in iPhone (6)

    Sunday
    Jun172012

    Mobile Nerf Tank



    We have been experimenting a little more with Arduino and decided that Mobile Tape Measures are cool, but Nerf guns are even cooler! We like Nerf guns a lot but after a while it gets a little tiring to run around. Plus, the more you run, the more of a target you become. So we figure, why not put together a mobile nerf tank that will solve the problem at hand? Below is a prototype we are building, there are still a few things to do, such as adding accelerometer and gyroscope support for controlling the car and the arm, and potentially replacing the arm with actual servos - it's just more cool if it made from scratch. While this may seem a frivolous project, we actually think it may change the world (our mission). For example, nerf fights are now available to the physically disabled. Now it's fun to scold your kids - you can chase them down with one of these things in the comfort of your couch. You are an artist with no kids? We didn't forget you. Simply dip the foam darts into different color paints and you can create Nerf art by controlling multiple Nerf tanks and pre-programming shooting patterns all from a single phone. As you can see, the possibilities are limitless (ok, there are at least ten uses). 

     

    Monday
    May022011

    Hungry Monster

    Good news to all the kids in the world. Hungry Monster got approved today.  Hungry Monster is created by Steve Breen, a two-time Putlizer Prize winner in Editorial Cartoons.  All animations you see in the app are meticulously hand drawn.  A port to the Android platform will come soon.

    Sunday
    Apr172011

    Xcode Build and Archive Sharing Problem (and Solution)

    In our last post regarding Xcode, we gave you 10 simple steps to rename your Xcode project. In this post I assume that you know how to create an ipa file from Xcode.  For info on how to do that, check this article out: http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-3

    Recently I ran into an annoying issue while trying to create an ipa file using Build and Archive.  Xcode would compile and verify the app fine, but when I tried to share the archive application (via Organizer->Archived Applications->Share), a spnner would appear and go away and the usual Save ipa file dialog would not appear.

    It's apparent (or maybe not) that something is causing Xcode to bail out of the process.  The next step is to figure out how we can get more info that tells us why Xcode is not behaving the way it normally does.

    To achieve that, let's eliminate Xcode out of the picture and get our hands dirty by building the app from the good old terminal and hopefully that will allow us a better picture on what went wrong.

    1. Build the project to .app file 

    xcodebuild -target "${PROJECT_NAME}" -sdk "${TARGET_SDK}" -configuration Release

    In our case, the command is

    xcodebuild -target "Word Tracer" -sdk "iOS 4.2" -configuration "Ad Hoc"

    Note: You can skip this step by building in Xcode. 

    2.  package .app file into an .ipa file

    /usr/bin/xcrun -sdk iphoneos PackageApplication -v"${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o"${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}”

    In our case, the command is 

    /usr/bin/xcrun -sdk iphoneos PackageApplication -v build/Ad\ Hoc-iphoneos/WordTracer.app -o WordTracer.ipa --sign "test name" --embed "/Projects/WordTracer/test.mobileprovision"

    Sure enough, I got the error below after running the command.

    + /usr/bin/codesign --verify -vvvv -R=anchor apple generic and (certificate 1[field.1.2.840.113635.100.6.2.1] exists and (certificate leaf[field.1.2.840.113635.100.6.1.2] exists or certificate leaf[field.1.2.840.113635.100.6.1.4] exists)) /tmp/r3kFZTMcqd/Payload/WordTracer.app

    Program /usr/bin/codesign returned 1 : [/tmp/r3kFZTMcqd/Payload/WordTracer.app: a sealed resource is missing or invalid

    /tmp/r3kFZTMcqd/Payload/WordTracer.app/letter_data/hei_计.plist: resource added

    /tmp/r3kFZTMcqd/Payload/WordTracer.app/letter_data/hei_计.plist: resource missing

    ]

    Great, now we got more info that we did in Organizer.  Armed with this piece of info we can begin to investigate what halted the build process. It looks like hei_计.plist is the culprit. I double checked the file name in terminal. It turned out that there is a character \036 in it which won't appear in Finder (another reason why you should always rely on Terminal for things like this).  A quick conversion from \036 (octal) to hex gives us 0x1E.  It looks like this is a control character of some sort (http://www.fileformat.info/info/unicode/char/1e/index.htm) and this is what was causing a hiccup in the ipa packaging process.

    I proceeded to remove the character \036 from the filename, rebuilt the app and this time Organizer allowed me to save the ipa file like it normally does.

     

    Monday
    Feb282011

    Binary file names cannot contain a space

    If you try to submit an app with a blank space in the app name, you may run into this error at the validation phase: "Binary file names cannot contain a space"

    To fix this, follow the steps below:

    Step 1) Right click on the app that you just "Build and Archive" on. Select Show in Finder.


    Step 2) Proceed to remove the blank name out of the .app file and .dSYM file. Double click ArchiveInfo.plist to edit it in Property List Editor.


    Step 3) Update the entries in ArchiveInfo.plist by removing the blank space from the XCApplicationName and XCApplicationFilename and save the file.

    Resubmit the app and it should go through without a hitch. Hopefully this will be fixed in future version of Xcode.

    Friday
    Jan212011

    How to synchronize your app data using Dropbox API





    1. Preparation

     


     

    2. Start the project

     

    Create an new Navigation-based Application. There is no need to check the Use Core Data for storage option if you don’t intend to use one.

    Then integrate the Dropbox API.

     

    (1). Right-click on your project in the group tree in the left pane

    (2). Select Add -> Existing Files...

    (3). Navigate to where you uncompressed the Dropbox SDK and select the DropboxSDK subfolder

    (4). Select "Copy items into destination group's folder"

    (5). Make sure "Recursively create groups for any added folders" is selected

    (6). Press Add button

    (7). Find the Frameworks folder in your app's group tree in the left pane

    (8). Make sure the framework Security.framework is added to your project

    (9). If not, right-click on Frameworks and select Add -> Existing Frameworks...

    (10). Select Security.framework from the list and select Add

    (11). Build your application. At this point you should have no build failures or

           warnings

     

    This is what it looks like this after you have taken the steps above to include the API.

     

    3. Configuration

     

    Now we are ready to start using the Dropbox API.

    Open the Dropbox_TutorialAppDelegate.m add the following codes.

    These codes init the Dropbox link session with the app keys we just applied for.

     

    4.Build the Main Interface and Hook up.

     

    To keep things simple, we are not going to use any additional xib files.  Go ahead and edit the RootViewController.  It should look like this after added all the components we need.


    Let’s initialize the view’s title and create an “Add” button on the navbar.

     

    Next, in your header file, create a IBOutlet to your Table View and the Activity Indicator. We are going to use the table view for show the items we download from Dropbox and the activity indicator to indicate Dropbox operation is in progress.

     



     

    5. Maintain the DBRestClient

     

    In order to call Dropbox API, you need to implement the DBRestClientDelegate protocol and create a DBRestClient.

     

    Add the following to your header file.

    Also should define the getter method of restClient in .m file

     

    Next, use DBSession has linked in ViewDidLoad to determine if there is already a session. If not, have Dropbox show a login window.

     

     

    Go ahead and implement delegates for DBLoginController.  In this tutorial there is no need to do anything.


     6. Init the app

     

    Let’s create a mutable array to store the datasource.

     

    Call Dropbox’s loadMetadata in the viewWillAppear.

     

    This will Read all the filename (include folder) into a mutable array and make it the tableview dataSource.

     

    In loadMetadata delegate, we will populate the table with the filenames and folder names contained in the metadata.

     


    Let’s test the app with what we got so far.  When you launch the app and log into your Dropbox account, you will see something like the following:

      

    7. Main functions of the app

     

    Now we are ready to implement the core functionalities of our app.  If you recall, previously we have made it so the app will read all your files in your Dropbox folder and list it in the table view. Now we will make it so when you press the Upload button, it will collect the data, write them into a plist file and upload it. If you press the Download button, it will look for the same file you just uploaded, download it and replace the current tableview data.  Just how a normal Backup operation should behave right?

     

    Let’s declare the functions in the header file.

     

    Implement a help function to get the document path to the file we are saving to Dropbox account.

     


    Pay attention to the two underlined functions on how we implement upload and download.  When the upload or download operation is complete, it will call its corresponding delegate.

     

    And the error handling, we will show the relevant information in an alert view.  You may decide to do differently for your own apps.

     

     

    Now let’s test our Upload/Download feture.  We are going to add a button to add a random line of text (in this case, the current date time) to our table view

     

    For the kick of it, we will implement the swipe-delete behavior for the table view.

     

     

    And that’s it!  Run the app, add a few lines of texts by pressing the Add button.  Press the upload and download button to verify things work as they should.  As you can see, Dropbox has made it very easy for you to back up and restore you information. Go Dropbox!

     

    Notes

    Dropbox API calls require connectivity and take time to complete.  Be sure to display indication that the operation is underway and account for situation in which your user's device does not have connectivity.

    Most Dropbox's API calls are asynchronous/non-blocking which means it won’t wait until the uploading or downloading is finished. Instead, will tell the request queue to add the task, then directly proceed to the next line of code. So the only way to react to things is to implement their respective delegates such as uploadedFile, downloadedFile, etc.