Thursday, May 24, 2012

Unit test with NSBundle


When the unit test harness runs your code, your unit test bundle is NOT the main bundle. Your code is searching the wrong bundle. If you replace the above line with:
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *path = [bundle pathForResource:@"foo" ofType:@"txt"];
Then everything will be fine.

Wednesday, May 23, 2012

An easy option to backup your application data

I have been searching a good way to back up application data by user. You may use iCould, that's for iOS 5 and later. Or you can use DropBox, that one is easy and flexible, but you force user to get a dropbox account.

Today I found an easy way, user can do it menully,  backup through iTune file sharing.

http://support.apple.com/kb/HT4094

Simply put this key in your plist file will do the magic, no code required.


UIFileSharingEnabled

Tuesday, November 15, 2011

save data in local storage

localStorage.setItem("name", "Brian");
var name = localStorage.getItem("name");
localStorage.setItem("data", {"foo":"bar","flip":"rep","arr":[1,3,4]});
var data = localStorage.getItem("data");

Tuesday, October 25, 2011

NFC Primer for Developers

NFC Primer for Developers

A good turtoial for object saving on plist

http://cocoadevcentral.com/articles/000084.php

Add UIProgressView to UITableViewCell

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"downloadcell"];
if(cell==nil)
{
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                 reuseIdentifier:@"downloadcell"] autorelease];
    UIProgressView* downPreView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
    downPreView.tag = 1234;
    downPreView.frame = CGRectMake(400,70, 200,10);
    [cell.contentView addSubview:downPreView];
}
 
//update the progress
UIProgressView* downPreView = (UIProgressView*)[cell viewWithTag:123];
downPreView.progress = downloadPre;
 

Monday, October 17, 2011

PhoneGap and ASIHTTPRequest conflicting problem


Re: Conflict with ASIHTTPRequest (Reachability Issue)

Postby ryanagler » Tue Aug 02, 2011 10:12 pm
I dont know the reprecussions of this, but it appears I got it to work by replacing the Reachability.h that comes with ASIHTTPRequest with Apple's version 2.2 here:

http://developer.apple.com/library/ios/ ... lementID_5