Using/Modifying Generated Code

You must Login before you can answer or comment on any questions.

I really bope that someone is going to be able to help me with this!!!! I have an app written up in Titanium which is ready to go but for one thing - I need to setup a local notifiction that repeats every minute. iOS allows this. However, the Titanium implementation only recognizes dairly, weekly, monthly and yearly. Poking into the generated code I found this code block

id repeat = [args objectForKey:@"repeat"];
    if (repeat!=nil)
    {
        if ([repeat isEqual:@"weekly"])
        {
            localNotif.repeatInterval = NSWeekCalendarUnit;
        }
        else if ([repeat isEqual:@"daily"])
        {
            localNotif.repeatInterval = NSDayCalendarUnit;
        }
        else if ([repeat isEqual:@"yearly"])
        {
            localNotif.repeatInterval = NSYearCalendarUnit;
        }
        else if ([repeat isEqual:@"monthly"])
        {
            localNotif.repeatInterval = NSMonthCalendarUnit;
        }
    }
which suggests that I should be able to hack into something somehow and use NSMinuteCalendarUnit. But hack what and how? If anyone could help me with this I really would be HUUUUUUUUUGELY grateful.

— asked 1 year ago by Et Kit
0 Comments

4 Answers

Accepted Answer

Here to go to hack Titanium:

/Library/Application Support/Titanium/mobilesdk/osx/YOUR_TI_SDK/iphone/Classes/

Hello.

I'm not sure about this, I just started to hack Titanium source code myself. -_-

What you need to do is to make custom build of Titanium mobile SDK. TiSDK actually generates application template that is compiled as application along with JS source files that are interpreted at runtime. That application template can be changed and that is what you need to do.

To build Titanium from the source, follow this instructions:

http://developer.appcelerator.com/question/3931/building-titanium-from-source

That tutorial misses one part, you need to download Android NDK and export its path:

//shell
export ANDROID_NDK=path/to/android_ndk
(Python is preinstalled on OSX, you need scons - see Wiki) Here is more info: https://wiki.appcelerator.org/display/guides/How+to+Contribute+Code

You can speedup building process: https://gist.github.com/1596914

You you successfully built Titanium from the source, you can modify its source and use your own changes as custom SDK build (and you can make pull request to make your changes available to all devs :) ).

Thanks. I might try that. It beats me why they did not use the full set of CalendarUnit constants. Why leave out minute and hour? It makes no sense.

Ummm... just one question - I cannot see anything under Library/Application Support/Titanium/.,..

Is that because I am using the freebie version? It should be a simple matter to change the code above so it accepts per minute local notifications - if only I could lay my hands on it.

Your Answer

Think you can help? Login to answer this question!