Found a problem with the Snap sample project from Ray Wenderlich site - the poker/playing card images are only for iPhone, and the resolution is not good enough for iPad/iPad Retina!! Need to find a way to create 52+ (plus back, joker, ...etc) card images...
Was looking at some sample codes on the net and thinking about writing a small "auto card image generating" application which allows users to edit their favourite photos and use it as the card image or something like that (any one got this running or available already? Please let me know!). Later found that there's actually quite a few free vector images for playing cards available on the net, cool!
Found 2 so far:
1) https://code.google.com/p/vector-playing-cards/ by Bryon Knoll
2) https://code.google.com/p/vectorized-playing-cards/
or
http://sourceforge.net/p/vector-cards/home/Poker%20Sized%20Playing%20Cards%20in%20Vector%20Formats%20(.SVG%20and%20.EPS)/ by Chris Aguilar
Personally I think the 2nd one looks better...
Any way, an extra resource for any one interested in making any card games! Enjoy!
New 2 Objective-C
Blog to keep track of my Objective-C, iOS development learning journey
Friday, 17 May 2013
Thursday, 2 May 2013
iPhone 5s with fingerprint reader, 13 megapixel camera and iOS7!
Read this news from appleinsider.com about French website Nowhereelse.fr reports leaked document from Japan about new iPhone 5s coming with fingerprint reader, 13 megapixel camera and iOS7, cool!
Need to reboot iPhone 5 to recover internet connection??!!
I am with Telstra and don't know why but every now and then (around every few weeks?) the internet connection on my iPhone 5 would hung and wouldn't response at all.
When it first happened a while back, there's really bad storm outside and I have to call Telstra help desk for help. The instruction I received was to shut the phone down completely and turn it back on 30 seconds later.
Since then it happened quite a few times already. Not sure if it's Telstra issue or iPhone issue, and wonder if anyone having similar issue as well??
When it first happened a while back, there's really bad storm outside and I have to call Telstra help desk for help. The instruction I received was to shut the phone down completely and turn it back on 30 seconds later.
Since then it happened quite a few times already. Not sure if it's Telstra issue or iPhone issue, and wonder if anyone having similar issue as well??
Thursday, 25 April 2013
Damn, multi-player game is so complicate!
I have got my single player version of Spade game working for a while and I have been quite excited with that - until I started working on the multi-player side - which made me so depressed... Damn, multi-player game is so complicate!
There's so many things to cover in a 4 players card game when there's multiple devices involved. As unlike single player mode where the 3 other computer players can be easily managed, now you could have mixed of 4 physical devices or 2 physical and 2 computer players...
And as things go on, I noticed the code have grown bigger and quiet difficult to manage. Debugging is also a nightmare as I now have to switch between the logs of the client and server devices, and work out where the problem came from - and have to test multiple times to make sure my fix doesn't break the single player mode too...
Any way, I am slowly getting there... Just posting a few screens here (running in debug mode, that's why all cards are visible), already changed a lot since the previous one in end of January... Oh, gash I am so slow, it's already end of April! I wish I have 72 hours per day to work on my games...
There's so many things to cover in a 4 players card game when there's multiple devices involved. As unlike single player mode where the 3 other computer players can be easily managed, now you could have mixed of 4 physical devices or 2 physical and 2 computer players...
And as things go on, I noticed the code have grown bigger and quiet difficult to manage. Debugging is also a nightmare as I now have to switch between the logs of the client and server devices, and work out where the problem came from - and have to test multiple times to make sure my fix doesn't break the single player mode too...
Any way, I am slowly getting there... Just posting a few screens here (running in debug mode, that's why all cards are visible), already changed a lot since the previous one in end of January... Oh, gash I am so slow, it's already end of April! I wish I have 72 hours per day to work on my games...
iPad 2 damaged after accidental drop
My little one dropped my iPad 2 to the floor accidentally while walking down the stairs... Even though it's protected in a cover, the volume on/off buttons, the volume up/down buttons all stopped working. Now we can't play any music or sound from the device any more, and it always display this huge gray square icon image in the middle of the screen all the time, very annoying...
After removed from the case, can visually see 2 damaged spots...
Wonder how much would cost to fix it... May be time to get a new iPad 4 or iPad mini, or better wait until end of June as WWDC 2013 is coming and there will definitely be new products announced??!!
[Update]
Sent an email to the iExpert guys where I normal get my iDevices repaired and received response within minutes as below even though it's public holiday today (ANZAC day) in Australia:
[Update]
Lucky it's only the button been stuck due to the dent, the audio and other parts are still functioning. Only cost me $40!! Yeah!
After removed from the case, can visually see 2 damaged spots...
Wonder how much would cost to fix it... May be time to get a new iPad 4 or iPad mini, or better wait until end of June as WWDC 2013 is coming and there will definitely be new products announced??!!
[Update]
Sent an email to the iExpert guys where I normal get my iDevices repaired and received response within minutes as below even though it's public holiday today (ANZAC day) in Australia:
The price will depend on whether we need to remove the glass or not. If we need to remove the glass, there is a risk of breakage that needs to be factored into the cost.If it is a minor dent that can be removed without lifting the glass, we would charge a $25 service charge.If the glass needs to be lifted, we would charge $65.In rare cases, the dent damages the switches underneath the volume button. If this is the case, the switches can be replaced for $89.We can determine the price upon inspection of the device. Please note that when Aluminium is bent it creates small white streaks in the metal. There will be a permanent minor cosmetic blemish after the repair.
Will see how it goes, fingers crossed...
[Update]
Lucky it's only the button been stuck due to the dent, the audio and other parts are still functioning. Only cost me $40!! Yeah!
Thursday, 21 March 2013
What works on the simulator might not work on the device
Still working on my card game, strangely although it works perfectly on the Simulator, when I tried to run it on the device it always crash at this line
The error message is as below, and it wasn't very helpful.
The declaration is as below in the header file
@property (nonatomic, assign) NSMutableArray *gameCurrentPoints;
It's then synthesized with local variable as below
@synthesize gameCurrentPoints = _gameCurrentPoints;
It took me a while to realise, I should have use "retain" instead of "assign" as shown below. But I still don't understand why it works on simulator but failed on the device....
@property (nonatomic, retain) NSMutableArray *gameCurrentPoints;
Another lesson learned...
_gameCurrentPoints[0] = [NSNumber numberWithInt:0];
_gameCurrentPoints[1] = [NSNumber numberWithInt:0];
The error message is as below, and it wasn't very helpful.
2013-03-21 20:50:37.679 Spade[6077:907] -[__NSCFString setObject:atIndexedSubscript:]: unrecognized selector sent to instance 0x1f876070
2013-03-21 20:50:37.681 Spade[6077:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString setObject:atIndexedSubscript:]: unrecognized selector sent to instance 0x1f876070'
*** First throw call stack:
(0x344ee3e7 0x3c1df963 0x344f1f31 0x344f064d 0x34448208 0x1016fb 0xff44b 0xd5309 0xd927f 0x36413c65 0x363986ab 0x36398485 0x36397ddf 0x365d7d05 0x363ea99f 0x363e8fab 0xd9121 0xd52c9 0x36312abb 0x363878fd 0x360be309 0x3c5f95db 0x3c5fce45 0x344c21b1 0x3443523d 0x344350c9 0x3801333b 0x363512b9 0xd3d29 0xd3cb0)
libc++abi.dylib: terminate called throwing an exception
(lldb)
It's then synthesized with local variable as below
@synthesize gameCurrentPoints = _gameCurrentPoints;
It took me a while to realise, I should have use "retain" instead of "assign" as shown below. But I still don't understand why it works on simulator but failed on the device....
@property (nonatomic, retain) NSMutableArray *gameCurrentPoints;
Another lesson learned...
MathJax v2.1 works beautifully on iOS 6.1 !!
Tested MathJax v2.1 on iOS 6.1 using same steps mentioned in my previous post, and it works beautifully as expected. Tested on both iPhone/iPad simulator and my iPhone 5, all works perfectly.
Also checked app size on iPhone 5 using "Usage", and as below it's only 7.2MB. You definitely got plenty of space for your other stuffs!
I think if you have to time to do more research, for example, follow steps mentioned in this post by Davide Cervone you should be able to trim down even more! Have a go and welcomed to share your experience with everyone.
Well done, MathJax guys, thanks for the excellent work!
Also checked app size on iPhone 5 using "Usage", and as below it's only 7.2MB. You definitely got plenty of space for your other stuffs!
I think if you have to time to do more research, for example, follow steps mentioned in this post by Davide Cervone you should be able to trim down even more! Have a go and welcomed to share your experience with everyone.
Well done, MathJax guys, thanks for the excellent work!
Saturday, 9 March 2013
Passed-by-value struct argument contains uninitialized data
While working on the card game, keep getting this annoying warning: "Passed-by-value struct argument contains uninitialized data" but couldn't work out anything wrong....
Later realised it's complaining about the "tmp" CGPoint variable returned from the other method "getCardPositionWithIndexForPlayer". Checked that method and at the beginning it's just a simple declaration, in the middle there're 2 few different "if" condition checks that assign value to the variable, and then return the value.
} else if ((player.position == PlayerPositionBottom) || (player.position == PlayerPositionTop)) {
....
return tmpPoint;
I guess the compile is complaining that that's no trailing "else" at the end of the last "if" block - in case there's a condition not covered. So I fixed it by changing the 2nd "if" check to "else" only, as if the player is not at left or right position, must be either at bottom or top. Problem solved.
Later realised it's complaining about the "tmp" CGPoint variable returned from the other method "getCardPositionWithIndexForPlayer". Checked that method and at the beginning it's just a simple declaration, in the middle there're 2 few different "if" condition checks that assign value to the variable, and then return the value.
CGPoint tmpPoint;
....
if ((player.position == PlayerPositionLeft) || (player.position == PlayerPositionRight)) {
....
....
}
I guess the compile is complaining that that's no trailing "else" at the end of the last "if" block - in case there's a condition not covered. So I fixed it by changing the 2nd "if" check to "else" only, as if the player is not at left or right position, must be either at bottom or top. Problem solved.
You get what you paid for
Sometimes you might wonder why Apple charged so much for their products. Just give you 2 examples I heard from friends.
First was the "Lightning to USB cable", Apple charged AU$25.00 in Australia, but you can also get something similar from ebay for about AU$5.00. So how bad is the quality of the cheap ones if it cost only 1/5 of the Apple ones?
A friend of mine got one from an Hong Kong ebay seller and she was quite happy with it for a few weeks. Then one day somehow she found the cable was sort of stuck with the phone, so she pulled a little bit harder and the white plaster cover fell off. That is, from this
She was a bit shock and since then the plastic thing came off quite easily. As it's still working ok, she later got her boy friend to apply some super glue on it and that fixed the problem...
The second one was also similar, but with a different product - a "Lightning to 30-pin Adapter" which Apple charged AU$35.00 in Australia, and you can get something similar from ebay for around AU$3.00, which is more than 10 times difference!
Another friend who bought one from ebay, found the gray coloured plastic thing around the 30 pin adapter side keep falling off whenever he try to unplug the adapter as shown below. And as shown below he could then easily pop out the whole circuit board by pressing on the lightning connector side.
My friend was however very lucky as this happened the 2nd day after goods received. He complained to the ebay seller who was also based in Sydney, and received another new one within a few days. When asked about sending the faulty one back, the seller doesn't even want it (May be it's so cheap that it doesn't worth the effort??) I told him about the super glue fix, he tried it and that works too. He now got 2 functioning adapters for the price of one, and was very happy about it...
So would you pay 5 or 10 times more for accessories from Apple shop? Both my friends recon they still saved a lot even with the extra cost of a super glue ... :-)
First was the "Lightning to USB cable", Apple charged AU$25.00 in Australia, but you can also get something similar from ebay for about AU$5.00. So how bad is the quality of the cheap ones if it cost only 1/5 of the Apple ones?
A friend of mine got one from an Hong Kong ebay seller and she was quite happy with it for a few weeks. Then one day somehow she found the cable was sort of stuck with the phone, so she pulled a little bit harder and the white plaster cover fell off. That is, from this
to this:
She was a bit shock and since then the plastic thing came off quite easily. As it's still working ok, she later got her boy friend to apply some super glue on it and that fixed the problem...
The second one was also similar, but with a different product - a "Lightning to 30-pin Adapter" which Apple charged AU$35.00 in Australia, and you can get something similar from ebay for around AU$3.00, which is more than 10 times difference!
Another friend who bought one from ebay, found the gray coloured plastic thing around the 30 pin adapter side keep falling off whenever he try to unplug the adapter as shown below. And as shown below he could then easily pop out the whole circuit board by pressing on the lightning connector side.
My friend was however very lucky as this happened the 2nd day after goods received. He complained to the ebay seller who was also based in Sydney, and received another new one within a few days. When asked about sending the faulty one back, the seller doesn't even want it (May be it's so cheap that it doesn't worth the effort??) I told him about the super glue fix, he tried it and that works too. He now got 2 functioning adapters for the price of one, and was very happy about it...
So would you pay 5 or 10 times more for accessories from Apple shop? Both my friends recon they still saved a lot even with the extra cost of a super glue ... :-)
Tuesday, 5 March 2013
Really cool video about Sprite Sheet!
Andreas got quite a few really cool and interesting videos about Sprite Sheet,
have a look !
have a look !
Thursday, 21 February 2013
iPhoneDevSdk in trouble again!
After I found their site always get infected by malware since late 2011 (see this old post of mine), I tries to stay away from iPhoneDevSdk to avoid all the troubles.
Now iphonedevsdk.com is in trouble again. I guess if you are running a popular site, you got to be extremely careful with your security as all the bad guys would be targetting you! This reminds me of a few other ones like stackoverflow.com, Techcrunch, ...etc.
With cyber security issues on the rise, e.g. recent news about this Unit 61398 in Shanghai, China, wonder what's going to happpen next? Very scarely.
Looking at different angle, this would mean cyber security related positions/experiences/certificates would be more popular and worth more! Never too late to do more research/study in that area and ask for pay rise or look for better opportunities!
Now iphonedevsdk.com is in trouble again. I guess if you are running a popular site, you got to be extremely careful with your security as all the bad guys would be targetting you! This reminds me of a few other ones like stackoverflow.com, Techcrunch, ...etc.
With cyber security issues on the rise, e.g. recent news about this Unit 61398 in Shanghai, China, wonder what's going to happpen next? Very scarely.
Looking at different angle, this would mean cyber security related positions/experiences/certificates would be more popular and worth more! Never too late to do more research/study in that area and ask for pay rise or look for better opportunities!
Sunday, 27 January 2013
Having fun with Multiplayer Card Game
Oops, just realised I haven't write anything for almost a month :-) ....
Well, other than having a quite relaxed month and gained a few kilos, iOS development wise, I have been studying the "huge" Simple Card Game with Multiplayer and Bluetooth tutorial by Matthijs Hollemans. Yes, I know it's a bit old - created around Jun 2012, however the amount of the work required to setup a multiplayer was amazingly complicate and took me a long time to get it working.
I learned a lot from the tutorial, and currently working on changing it into some sort of "template" card project (yes! it's mine! mine! ha ha ha...). The idea is hopefully I can get it working so that I can then create different kind of multiplayer card games based on the template. Have been working on it for a while, unfortunately it's quite complicate for me due to limited time plus my "not-so-great" level of skills, really have no idea how long it's going to take :-(...
Sample of work-in-progress shown below:
Just renewed my Apple membership this week. For the past 12 months, although I finished quite a few projects, only got 2 games published so far. Hopefully this template card project goes well and I can create a few card games in the coming year, wish me good luck!
Happy coding!
Well, other than having a quite relaxed month and gained a few kilos, iOS development wise, I have been studying the "huge" Simple Card Game with Multiplayer and Bluetooth tutorial by Matthijs Hollemans. Yes, I know it's a bit old - created around Jun 2012, however the amount of the work required to setup a multiplayer was amazingly complicate and took me a long time to get it working.
I learned a lot from the tutorial, and currently working on changing it into some sort of "template" card project (yes! it's mine! mine! ha ha ha...). The idea is hopefully I can get it working so that I can then create different kind of multiplayer card games based on the template. Have been working on it for a while, unfortunately it's quite complicate for me due to limited time plus my "not-so-great" level of skills, really have no idea how long it's going to take :-(...
Sample of work-in-progress shown below:
Just renewed my Apple membership this week. For the past 12 months, although I finished quite a few projects, only got 2 games published so far. Hopefully this template card project goes well and I can create a few card games in the coming year, wish me good luck!
Happy coding!
Tuesday, 25 December 2012
PVR image not loading issue (glError: 0x0501) with iPod Touch 4th Generation
Merry Christmas everyone! Hope everyone got you wished for!
Bought a 4th generation iPod Touch for kid, one personal reason for that is, I already have an iPhone 3GS and an iPhone 5, therefore need something in the middle to cover all main iPhone models so that I can test all my apps properly, heh heh heh....
So while no one is paying attention to the iPod Touch (busy reading the new Diary of Wimpy Kid book...), I quickly installed my apps on it for a quick test.
Mespfi works perfectly well, that's a tick, good job!
Strangely, Where Is It - Smart Kids Edition (uses Cocos2d) didn't. Although the splash page shows up ok, As below, none of the images for the main menu (and all pages after that as well) loads properly.
Quickly connect to XCode and tried again - it died too, as below due to this "glError: 0x0501" error. But if it works in all versions of simulators, plus iPhone 3GS, iPhone 5 and iPad 2, why doesn't it work with iPod Touch 4th generation??!!
As I have seen this error before (see this post) I know straight away it's due to the size of the texture .pvr files. After shuffle the images around for the iPhone ones, and removed the following 2 lines from the script that creates the texture files using TexturePack, that fixed the problem.
--max-width 4096 \
--max-height 4096 \
Unfortunately App Store won't be available until 28/12, have to wait a few more days to submit the update.
That worries me a bit, I thought all Apple products should be quite similar and wouldn't need to test your apps in all different versions of physical devices?
Sunday, 9 December 2012
Issue with iOS 6 Game Center landscape app issue fixed
Got my iPhone 5 temporarily working by connecting to WiFi while still waiting for the new SIM. First thing I did was obviously download my 2 games from App Store and have a go, but to my biggest shock, Where Is It Smart Kids Edition crashed after the splash page, how could this be??!!
Tried it in XCode and it crashed too! Error message as below:
Tried it in XCode and it crashed too! Error message as below:
2012-12-09 20:53:19.490 Where is it[395:907] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
*** First throw call stack:
(0x3978d3e7 0x387e6963 0x3978d307 0x33005857 0x331a9f21 0x33089cdd 0x33088f6b 0x39790ad4 0x396e828f 0x331a70f3 0x352b2e01 0x32575793 0x325755db 0x32578e45 0x397611b1 0x396d423d 0x396d40c9 0x3983033b 0x32ff1291 0xdf2d9 0x4c410)
libc++abi.dylib: terminate called throwing an exception
(lldb)
Found this link from Stackoverflow.com which describes something similar to what I am experiencing, which only happens to iOS 6 Game Center for Apps only supporting Landscape display. Delete the app and download from App Store again and test with Game Center logged in, and it works without problem. Problem identified!
Urh, hang on, I thought I fixed the problem in previous release already??!! Further investigation shows I missed something in my last release. And as my 3GS always has Game Center logged in, that's why it wasn't picked up during pre-release testing, damn! Definitely have to add this testing next time.
The fix is easy, before, the setup looks like this:
Just need to click on the 2 "Portrait" and "Upside Down" icons in "Supported Interface Orientations" and that fixed the problem. The setup now looks like this:
Issue fixed. Lucky the App Store still available before 20th December, hope there's not too many apps waiting for review and can still get reviewed before Christmas with the normal 7-8 days waiting time, fingers crossed...
Thursday, 29 November 2012
iPhone 5 activated, stuck with new Bluetooth problem
As I mentioned in this post I received my new iPhone 5 a few days ago, but can't use it at all because I haven't receive my new SIM card yet.
Sick of waiting, as a quick workaround, I borrowed colleague's SIM at work today and finally got it activated. Yeah! Issue resolved!
Then tried to pair with my 3GS (running iOS 6.0(10A403)) to share the connection using Bluetooth through Personal Hotspot and it doesn't work!! WTF!!
Searched the net and can see lots of people complaining about Bluetooth problem on discussions.apple.com.....Damn, this is so annoying....
On 2nd thought, I then tried a few different tests:
First, tried to pair my new iPhone 5 to colleague's iPhone 5, both on iOS 6.0 (10A405), but both can't see each other at all. Urh? Why is it like that?
Next, tried to pair my new iPhone 5 to another colleague's iPhone 4s on iOS 5.1.1 (9B206) which was jail-broken.... again, both can't see each other.
Then, tried on my MacBook Pro (OS X 10.7.5), found that I can actually see all 4 devices - old 3GS, my new iPhone 5, colleague's iPhone 5, and the other jail-borken iPhone 4s.
Very strange, does this mean all the iPhones are not suppose to pair/connect with each other, but it's allowed with MacBook Pro??!!
I am confused.
Noticed there's a new iOS 6.0.1 update available, will give that a try on the new iPhone 5 and see if that makes any difference...
[Update 10/Dec/2012]
Upgraded to iOS 6.0.1 doesn't make any difference.
Now that I got my new SIM, found that with Personal Hotspot enabled on iPhone 5, still can't connect from the 3GS using Bluetooth.
However found that in iPhone 5 Personal Hotspot, there's this "Wi-Fi Password" setting for you to connect using Wi-Fi, and found that works ok. So I am now using this to connect my 3GS to iPhone 5, finally got something that's working...
Sick of waiting, as a quick workaround, I borrowed colleague's SIM at work today and finally got it activated. Yeah! Issue resolved!
Then tried to pair with my 3GS (running iOS 6.0(10A403)) to share the connection using Bluetooth through Personal Hotspot and it doesn't work!! WTF!!
Searched the net and can see lots of people complaining about Bluetooth problem on discussions.apple.com.....Damn, this is so annoying....
On 2nd thought, I then tried a few different tests:
First, tried to pair my new iPhone 5 to colleague's iPhone 5, both on iOS 6.0 (10A405), but both can't see each other at all. Urh? Why is it like that?
Next, tried to pair my new iPhone 5 to another colleague's iPhone 4s on iOS 5.1.1 (9B206) which was jail-broken.... again, both can't see each other.
Then, tried on my MacBook Pro (OS X 10.7.5), found that I can actually see all 4 devices - old 3GS, my new iPhone 5, colleague's iPhone 5, and the other jail-borken iPhone 4s.
Very strange, does this mean all the iPhones are not suppose to pair/connect with each other, but it's allowed with MacBook Pro??!!
I am confused.
Noticed there's a new iOS 6.0.1 update available, will give that a try on the new iPhone 5 and see if that makes any difference...
[Update 10/Dec/2012]
Upgraded to iOS 6.0.1 doesn't make any difference.
Now that I got my new SIM, found that with Personal Hotspot enabled on iPhone 5, still can't connect from the 3GS using Bluetooth.
However found that in iPhone 5 Personal Hotspot, there's this "Wi-Fi Password" setting for you to connect using Wi-Fi, and found that works ok. So I am now using this to connect my 3GS to iPhone 5, finally got something that's working...
Subscribe to:
Posts (Atom)














