Wednesday, 26 February 2014

Damn! iOS Patch 7.0.6 killed my iPhone 5s !!

After successfully applied the 7.0.6 patch to my iPhone 5 over WiFi, logically I just apply the same patch to my iPhone 5s also through WiFi….. and then it died!!! WTF!

The screen shows this image to indicate I should connect to iTune (photo taken from iPhone 5 after connected the iPhone 5s to cable).


But in iTune it shows the device is in "Recovery Mode" and I was forced to restore the iPhone from backup. Wait, my last backup is more than 2 months ago, does this mean I am going to lose all my data/photo/apps in past 2 moths??!! NO!!!!!!!!!!!!!


Tried to stop it, but it wouldn't let me. Tried switch it off and on again, tried all buttons, holly crap! That's not very user friendly??!! Shouldn't you give me a chance to cancel the update and back up my data first??!!

Sucks! Really sucks! After various attempts I have no choice but to restore from that 2 months old backup and lost lots of stuff….. Stupid patch! And looks like I am not alone : see this link where lots of people having similar issue….

At least I learned a lesson, no longer trust any update from Apple any more, will definitely perform more regular backup - specifically before any update! Plus, may be update from iTune is safer than using Wifi!?




Thursday, 13 February 2014

Everyplay sounds very interesting, but my game doesn't use OpenGL?!

While studying descriptions of other games in App Store, noticed quite a few of them mentioned "Powered by Everyplay", for example, this one from Chasing Yello Friends:

"New video sharing powered by Everyplay, which allows you to show off your high scoring games!"

Did some study on it and quite surprised to find lots of popular games (bad piggies, hill climb racing, …etc) already using Everyplay to provide video play back and sharing function, this is amazing! Imagine your players can easily play back a video of the whole game (recorded while playing the game!) and then share it on the net!

They also have quite a few videos in YouTube, for example this one:


I am really excited about this and quickly signed up and downloaded their iOS SDK. Then I was stuck while trying to follow their tutorial  - the only iOS tutorial is using OpenGL but none of my game uses OpenGL and I don't have an "EAGLView" or "createFrameBuffer" method… Urh…. what now? Tried to search on the net and stackoverflow, but no one mentioned such silly newbie question like mine and I couldn't find any info about this in their Developer's FAQ section either.

Sent an email about this to their support area, let's wait and see what they say…

[Update 14/Feb/2014]

Happy valentines day everyone.

Bad news for me though, as I received email confirming what I don't like to hear - Everyplay requires OpenGL!! It would make every beginner's life easier if they can simply add this info to their FAQ...

Well, may be next time, as Everyplay still works with Cocos2D and Unity, may be can try later if there's any other future game using Cocos2D or Unity. Looks like they don't support Sprite Kit either…. Hmmmmm, that's another factor to consider while choosing between Sprite Kit or Cocos2d for future projects, as the function provided by Everyplay is really cool….


[Update 06/Nov/2014]
Everyplay now supports SpriteKit! See my latest post about this.

Tuesday, 11 February 2014

Getting closer to "seeing other players" in multiplayer game through Nextpeer

Have been working on improving my game with Nextpeer, and the most important feature I like to have, is to be able to "see other players". As shown in the sample screen below, the player can see the status of all other players, making the game more interesting and challenging.


One of the trouble I have is, although I was broadcasting data to the other players, I wasn't able to receive anything at all. Thanks to help from the Nextpeer support guys Alexander Mussafi and others, finally got it working by replacing the calls in AppDelegate to as below, and that solves the problem.
[Nextpeer initializeWithProductKey:NextPeerKey
                                 andSettings:settings
                              andDelegates:[NPDelegatesContainer containerWithNextpeerDelegate:self
                                                                                                      tournamentDelegate:self]];


What? You game still doesn't have multiplayer capability?! Give Nextpeer a try, you will be surprised how easy it is, and it's free! Plus, with the excellent service from their support guys, any problem of yours will be easily solved in no time! Honestly, I spent a lot more time getting the painful AV Foundation Framework to function properly than adding multiplayer capability to my game. 


One major problem solved, now back to the next one in the long list...

Sunday, 9 February 2014

First encounter with "UI Automation"

Was reading this book called "Test iOS Apps with UI Automation" by Jonathan Penn and I have my first trial of "UI Automation" inside Instrument today and it was quite interesting.


For those who never heard of "UI Automation", it's the trace template called "Automation" inside Instrument. It records your inter-actions with the simulator or the device, and then it creates a JavaScript file which you can later execute and it will simulate all the recorded UI interactions with your iOS application. The idea is, you can then sort of perform quite a lot of "boring" test steps to see if your latest modification caused any problem. Apple has a user guide here, and there's also an example here although it's a bit old.

However I found there's some limitations when using UI Automation with my latest game.

Although it did pick up "most" of the actions I performed on the device: such as tap on a button, swipe up or left, ...etc, occasionally it will miss a few swipe actions - and this makes it quite annoying. As my game relies heavily on user interaction, the execution of the test script failed quite frequently - as if user didn't swipe properly, the following action to tap on an button will certainly fail! I then have to track down which line failed, and manually add the swipe action.


Probably for iOS applications that has fixed buttons/tables would have a much higher success rate with UI Automation. Still recommend everyone to have a play with it, as it might save you lots of time with testing!

Sunday, 2 February 2014

Another SpriteKit game example - also about fighter planes....

Found another nice SpriteKit game example here. However this time there wasn't much details/explanation provided like other tutorials, therefore I am having some difficulties understanding the code and the design/structure.

I like the way how everything been put in it's separate classes, and the way the 2 layers of background cloud been handled, and different emitters been used when the hero fighter was hit to show how serious the plane was damaged.





The only problem is, for some unknown reason, the hero fighter wouldn't move on my iPhone 5 (iOS7). As shown in images above, the hero fighter is always stuck in the middle of the screen.

According to the code, it's using "CMDeviceMotion" in CMMotionManager to detect the roll and pitch of the device to move the hero fighter - by using "physicsBody applyImpulse" method - which is another new thing to me.

Thinking it might be problem with the device, I tried the same game on my iPad 2 (iOS7), it crashed on the first run due to "Main_iPad" storyboard missing. After I copied over an empty "Main_iPad" storyboard from another project, it works. However, still can't get the hero fighter to move at all, very strange.

Compared with the "Airplane" tutorial mentioned before - which uses "CMAccelerometerData"instead, and works on both my iPhone 5 and iPad 2. Suspect there's some problem with the code somewhere. Already left a comment and will wait for the author to help. May be if I can find some spare time, will convert it over to use "CMAccelerometerData" as well…

[Update] 04/Feb/2014

Yes, I got it working!

All I did was:
(1) Remove the following line inside "FighterGameScene.m"

  CMMotionManager *_motionManager;

(2) In "FighterGameScene.h" add an import at the top

#import <CoreMotion/CoreMotion.h>

Then add the following line near the end (before @end). That is, basically move the declaration of "motionManager" from  "FighterGameScene.m" to "FighterGameScene.h"

@property (strong, nonatomic) CMMotionManager *motionManager;

(3) Finally, inside "FighterGameScene.m" change the following lines:

        CMMotionManager *motionManager = [[CMMotionManager alloc] init];
        if([motionManager isDeviceMotionAvailable]) {
            [motionManager setAccelerometerUpdateInterval:1.0/30.0];
            [motionManager startDeviceMotionUpdates];

            [motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue new] withHandler:^(CMDeviceMotion *motion, NSError *error)

to the followings, note that I also removed the 4th line "[motionManager startDeviceMotionUpdates];" as that seems to be duplicate and I don't see that extra line in other examples on the net and books.

        self.motionManager = [[CMMotionManager alloc] init];
        if([self.motionManager isDeviceMotionAvailable]) {
            [self.motionManager setAccelerometerUpdateInterval:1.0/30.0];

            [self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue new] withHandler:^(CMDeviceMotion *motion, NSError *error)

As below, now it works on both my iPhone 5 and iPad 2. Before the fix, can only reach top score of 800 as the hero fighter will die after a few crashes (since it can't move!). Now I can get much higher score than that, yeah!




To be honest, I don't really understand why this fixed the problem. And if you look at Chris Grant's comments on his post, it works on his iPhone 5/5s even without the change!?

Would be really appreciated if any of you can kindly explain why this simple change fixed the problem, why it was working on Chris' devices but not mine before the change? Is there some settings in Xcode or the phone that could cause this issue??