:: iDavidStudio ::..

Dev log

Trick to resolve Moto 360 “Something went wrong. Try again?”

without comments

Moto 360, one of the best looking smart watch in the market at the moment, however, up to date, it is only available for sale in the U.S. Fortunately, I’ve found out a way to get one from the States.

Unfortunately (or fortunatly), once I’ve got the watch, there was new firmware released to be upgraded. However, ….  after my moto 360 paired with my phone ( HTC One M8), it just stucked on the error screen saying that:  “Something went wrong. Try again?”. Seems to me it was trying to connect to the moto server to download the latest firmware. Due to the watch only relased to the US market, my guess is moto blocked all connects from anyway outside the US.

I’ve done lots and lots of researchs, but still couldn’t found out the way to let it work, until…… I’ve found that I try to use the Skype app on my mobile to make a phone call!!! As soon as I was trying to make the phone call, the watch started to download the new firmware. I’ve tried this trick on another moto360 and it is working as well. Seems to me it is not by luck ;) Give this a try if you are having the same issue. Alternative, you may like to try using some free VPN services and make sure you selected the US VPN server ( I’ve found people are using this: http://www.justfreevpn.com/ give it a try? It might work as well) But i think the Skype solution would be the easiset.

Hooray~ my moto360 is working now. Really love it! Attaching some photos to share with you guys and good luck with the firmware upgrade.

IMAG0669_result IMAG0665_result IMAG0640_result IMAG0638_result IMAG0645_result IMAG0644_result IMAG0593_result IMAG0596_result IMAG0594_result

Written by admin

October 5th, 2014 at 3:49 pm

iBabe Pregnancy Calendar is live!

without comments

 

Hooray~ the iBabe Pregnancy Calendar is officially live on the Apple App Store today!

The iBabe project was initially created on the  28th Jul 2012 and it was live on the 11 Jul 2013. The whole development process has been last for nearly a year. During this year, a lot of things happened to me and the whole family. Thanks for everyone that provided help and supports. Without you guys iBabe Pregnancy Calendar may not be able to completed.

Special thank you to Koumei Deng, my best friend and iBabe’s another codes contributor; Rick Chen, my best housemate, the iBabe’s UI and English description legend; the team Design Junction and more …

Check out the iBabe Pregnancy Calendar from its official site:  http://ibabe.sigmapps.com.au

 

demo5 demo1
demo2 demo3 demo4

Written by admin

July 11th, 2013 at 8:10 pm

Posted in Milestones

Check if user’s ios version is iOS 6 + or not.

without comments

 

if (NSClassFromString(@”SLComposeViewController”) != Nil)
     // iOS6

}    else

{        // iOS 5, Social.framework unavailable, use Twitter.framework instead

}

Written by admin

April 28th, 2013 at 3:03 pm

Posted in iPhone Dev

iOS6 EKEventStore requires users grant access before getting any calender / reminder data.

without comments

ios App wont be able get any data from the Calendar on the iOS6 system if you don’t call the requestAccessToEntityType function to prompt a dialog to ask your users to grant access to your app to access the Calendar/Reminder. Below is the sample code:

 

EKEventStore    *eventStore = [[EKEventStore alloc] init];

//— This method “checkIsDeviceVersionHigherThanRequiredVersion” can be remove and use the official method to detect if user is using ios6 or later.

//—if([self checkIsDeviceVersionHigherThanRequiredVersion:@”6.0″]) {

if([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)]) {
// iOS 6 and later
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {

// perform the main thread here to avoid any delay. normally seems to be 10 to 15 sec delay.
[self performSelectorOnMainThread: @selector(presentEventEditViewControllerWithEventStore:) withObject:eventStore waitUntilDone:NO];

 

if (granted){
//—- codes here when user allow your app to access theirs’ calendar.

}else
{
//—– codes here when user NOT allow your app to access the calendar.

}

:
:
}];

}

 

 

– (void)presentEventEditViewControllerWithEventStore:(EKEventStore*)eventStore
{
EKEventEditViewController* eventEditVC = [[EKEventEditViewController alloc] init];
eventEditVC.eventStore = eventStore;

EKEvent* event = [EKEvent eventWithEventStore:eventStore];
event.title = @”My Event”;
event.startDate = [NSDate date];
event.endDate = [NSDate date];
event.URL = [NSURL URLWithString:@”http://www.idavid.com.au”];
event.notes = @”This is just a test event.”;
event.allDay = YES;
eventEditVC.event = event;

eventEditVC.editViewDelegate = self;

[self presentViewController:eventEditVC animated:YES completion:nil];
}

 

 

//**********************************************************************************

//   Below is a block for checking is current ios version higher than required version.

//**********************************************************************************

– (BOOL)checkIsDeviceVersionHigherThanRequiredVersion:(NSString *)requiredVersion
{
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];

if ([currSysVer compare:requiredVersion options:NSNumericSearch] != NSOrderedAscending)
{
return YES;
}

return NO;
}

Written by admin

September 21st, 2012 at 1:40 am

Posted in iPhone Dev

iOS 5 Weird Behavior with the UISegmentedControl setDividerImage

without comments

 

I’m using the appearance feature in the iOS 5 to customise the UISegmentedControl. Initially I was using the standard way to define different images for different divider status, it working fine when I tapped on each item. But when I set up the initial selected value to anything that rather than 0 (Zero), the divider behavior very weird:

 

 

 

* Images for different status:

Normal – Normal
Selected – Normal
Normal – Selected

 

 

 

// — Images for divider at different status.

UIImage *imgSelectedUnSelected = [[UIImage imageNamed:@”segments-selected-unselected.png”] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *imgUnSelectedUnSelected = [[UIImage imageNamed:@”segments-unselected-unselected.png”] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *imgUnSelectedSelected = [[UIImage imageNamed:@”segments-unselected-selected.png”] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

// — Dividers
[[UISegmentedControl appearance] setDividerImage:imgSelectedUnSelected forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance] setDividerImage:imgUnSelectedUnSelected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance] setDividerImage:imgUnSelectedSelected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault];

 

 

The way to fix this issue, I use a 1 pixel width image for the divider instead of the 3 different images above.

1 pixel divider imag

 

// — Dividers 1pixel images

UIImage *imgSelectedUnSelected = [[UIImage imageNamed:@”segment-divider.png”] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *imgUnSelectedUnSelected = [[UIImage imageNamed:@”segment-divider.png”] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *imgUnSelectedSelected = [[UIImage imageNamed:@”segment-divider.png”] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

 

It works fine now:

 

 

Written by admin

August 12th, 2012 at 6:11 pm

Adding code autoformat feature for your xCode

without comments

If you have been looking for the same codes auto-format feature in the xCode like what you have in the other famous IDE such as Visual Studio.net or Eclipse, you will be disappointed. Unfortunately up to the latest version of the xCode (version 4.4), there aren’t any good auto-format feature built-in. The only one that you might be able to get is the basic code re-indent function.

In this post I will show you how to use the Uncrustify (http://uncrustify.sourceforge.net/) to add auto-format feature into the xCode.

 

STEP 1: We will need to install the Uncrustify on to your mac. The easiest way to install it is through the Homebrew.

* Install the Homebrew: Copy and paste this line of code to your command console:

ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go)

 

Next is to install the Uncrustify – just simply copy and paste this command into your command console:

brew install uncrustify

 

SETP 2: You will need to download this Automate workflow file

unzip and then move it to the ~/Library/Services/ folder.  You can go the the folder that you downloaded the Automate workflow file and run the following commands:

mv Uncrustify-Objective-C.workflow.tar.gz ~/Library/Services/ cd ~/Library/Services/ tar zxvf Uncrustify-Objective-C.workflow.tar.gz

 

 

STEP 3: Download the pre set Uncrustify File for the Object-C: Unzip it > Rename it to  .uncrustify_obj_c.cfg  (Please note that there is a dot in front of the file name)and then move it to the ~/ folder by using the below commands:

 mv uncrustify_obj_c.txt ~/.uncrustify_obj_c.cfg

* The format can be customised by modifying the uncrustify_obj_c.txt file before moving to the ~/ folder. Just open the txt file and modify the row that relevant to your style. Each setting has been commented, should be very easy to be customised.

 

STEP 4: Set up the keyboard short cut for autoformat feature.

Go to the “System Preferences – Keyboard – Keyboard Shortcuts – Service” and then look for the newly added services item “Uncrustify Objective-C”. Here is the place that you can add the shorcut for the autoformat feature. Please keep in mind that don’t use any shor cut that might conflict with what xCode already using. The recommended one: “Option + Command + O”, this combination shouldn’t conflict with the xCode pre-set ones.

 

Enjoy it.

Written by admin

August 11th, 2012 at 4:21 pm

iBabe Alpha is On the GitHub Now!

without comments

After 3 months learning and development process the iOS version of iBabe Ver.Alpha has finally been released. Koumei and I am preparing for app testing, bug fixing and also optimizing the codes.

====  GitHub URL: https://github.com/davidliang/iBabe.git  ======

 

 

Written by admin

July 29th, 2012 at 1:17 pm

Posted in iPhone Dev

Uncharted UIBarButtonSystemItem

without comments



*Note: the id of the above buttons are from 100 to 109 (from left to right)

The above UIBarButtonSystemItems seem to be uncharted in the ios document. To list them use the following codes:


NSMutableArray *items = [NSMutableArray array];
UIBarButtonItem *item = nil;
for (int i = 100; i <= 109; i++) {
item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:i target:nil action:nil];
item.style = UIBarButtonItemStyleBordered;
[items addObject:item];
[item release];
}

item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:110 target:nil action:nil];
item.style = UIBarButtonItemStylePlain;
[items addObject:item];
[item release];

toolbar.items = items;

Written by admin

July 3rd, 2012 at 12:37 pm

Posted in Uncategorized

How to remove the .svn folders from the Mac OSX

without comments

You might want to clean up your svn info in the projects to resolve the version conflicts with the master copy, in Mac system to clean up the svn folders of your project, you can do the following:

  • Run the Terminal
  • Enter the directory of your project folder (ex: /My_Files/Projects/iBabe/)
  • Type the following commends:
    sudo find ./ -name ".svn" | xargs rm -Rf

Written by admin

June 26th, 2012 at 2:49 pm

Posted in Programming

Reg Exp For Valid Email

without comments

For Javascript

1
var regex = /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i;

Written by admin

September 9th, 2011 at 3:27 pm

Posted in Programming