2011年7月21日 星期四

魔導紀元增加金錢大法

我都很久沒在這個blog出過post啦,最近和朋友愛上玩iOS的魔導紀元,前陣它免費了所以下來就玩.
不過就是怪太強,錢太少,加上我一向都沒有心機玩RPG,我最多只會欣賞它的故事,人手升LV真係少之又少,幸好這遊戲本身就有比錢升級的功能,真是很像當年的J2ME RPG遊戲,所以我就拎左遊戲的save檔改錢啦.

要拎iPhone App入面嫁file就梗係要JB啦,不過我最近發現個叫iPhone Explorer的software,用佢就可以拎到iPhone App入面嫁file又不用JB,兩個字--方便.

Step 1:

當然是在iPhone到找出哪隻遊戲啦!!!

Step 2:

找到了,我一下子就把App Folder全拿了出來.

Step 3:

去$(App Folder)/Documents,找magicTime.rms.這裡真令我估不到,檔尾是rms--是J2ME遊戲最常用的儲存文件,真想用JSME開哪文件試試,不過最後都是只改了金錢,有機會再試!!!

Step 4:

最後記好這個位置,紅圈的就是金錢位置了,我只改了FF FF,即是65535,應該可以更大,不過65535我已經夠了=o=

2011年7月5日 星期二

當IOS App發生Exception時生成自定義Log Report

昨天看到有人POST一遍程序異常退出時發送郵件報告的代碼的文章,
今天試了一次,發現很實用,
可以幫助我們Developer在沒有Debug Console的情況下建立Log Report,
可惜是BAD_EXC_ACCESS的Exception就不能捕捉到Log Report了,
不過還是有用的,所以發上來。

// Define exception handler callback function
void UncaughtExceptionHandler(NSException* exception)
{
    // Get the exception detail infomation
    NSArray* arr = [exception callStackSymbols];
    NSString* reason = [exception reason];
    NSString* name = [exception name];
    NSString* exceptionStr = [NSString stringWithFormat:@"Exception Name : %@\nReason : %@\n Call Stack Symbols :\n%@", name,reason,[arr componentsJoinedByString:@"\n"]];

    // Save to log file and file encoding was UTF-8
    [exceptionStr writeToFile:[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, TRUE) objectAtIndex:0] stringByAppendingPathComponent:@"exception.log"] atomically:TRUE encoding:NSUTF8StringEncoding error:nil];

    // Print the exception message in debug console
    NSLog(exceptionStr);
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Setup the exception callback handler
    NSSetUncaughtExceptionHandler (&UncaughtExceptionHandler);

    return TRUE;
}