Loading a private frameworks in MacRuby - frameworks

I'm attempting to follow this tutorial 'Demystifying Mail.app Plugins on Leopard' to build a Mail.app plugin. Instead of using PyObjC I'm trying to use MacRuby. I've got MacRuby 0.6 loaded up and I've gotten to this step in the tutorial (PyObjC code):
MVMailBundle = objc.lookUpClass('MVMailBundle')
I've search the web a bit but can't seem to find any information about loading the private framework 'MVMailBundle' in MacRuby. Any ideas?
Thanks in advance - AYAL

I think the idea is that this plugin will be loaded into Mail.app, which will already have loaded the private framework in question. So we just want to look up a class at runtime (which is what that Python snippet is doing — not loading a framework). The way to do this in MacRuby is MVMailBundle = NSClassFromString 'MVMailBundle'.
(You will need to include framework 'Cocoa' in order to get the NSClassFromString method, but I assume you'll have already done this.)

MacRuby uses garbage collection and Mail doesn't. You can't load a GC bundle into a non-GC app. So this is a dead-end.

Related

iOS Application framework

I have created an ios application that can talk to the database and get the messages from the server and all i want to do now is to distribute this aplication as a templet and other application can import my current project and use it, Now i been went throw many tricks and tips such as making an Static framwork using xcode bundles and Aggregate target type and got it work with some script found hear: http://codefriend.blogspot.com.au/2011/09/creating-ios-framework-with-xcode4.html
what i want to know is whether its the correct approach for such a problem or should i been looking at something else. All i want to create is an framework for my team so that they can produce other application
without worrying about or writing same files and code again and again. And is it possible to bundle all the .xib and .html files too?
This is what we use to create framework:
https://github.com/kstenerud/iOS-Universal-Framework

WinJS.UI Metro Animation Library

I'm starting to port over my web app that I've built with Sencha Touch into the Windows 8 world. I'm seeing a lot of WinJS.UI documentation, basically telling me that there are more 'native' feeling animations and UI actions already build into this framework.
My app is already structured, but I'd like to mix in WinJS.UI if I can. How do I go about doing this? I haven't found a link to download the library or anything of the sort.
For example, this link:
http://blogs.msdn.com/b/windowsappdev/archive/2012/05/01/fast-and-fluid-animations-in-your-metro-style-app.aspx
I see that they are using:
<script>
function runAnimation(){
enterPage = WinJS.UI.Animation.enterPage(input);
}
</script>
But I find no documentation on where to include the library.
Little bit lost, any help is appreciated!
These animations are included in the UI.Js from the WinJS Package -- this is the same WinJS that is included in the default Visual Studio Templates. Just create a new HTML Windows Store application, and the details will be there.
Here's your library: http://code.msdn.microsoft.com/windowsapps/Using-the-Animation-787f3720
You can deploy this on your computer and play with the animations.

Including a static library inside a dynamic framework in iOS

I needed to create a framework (which requires a static library) for a project I'm working on. I used this tutorial to create the framework, then copied the static library into the project and it worked.
But, when I dragged the framework to an iOS project, it shows a ton of errors.
`Undefined symbols for architecture i386:"_OBJC_CLASS_$_SomeClassFromTheStaticLibrary",referenced from:_OBJC_CLASS_$_AnotherClass in MyFramework`
What I think is happening is that the iOS project wants to recompile the framework and it cannot, because it can't locate the static library. All errors disappear if I add the static library to the iOS project. This is what I want to avoid.
Basically I want to have the iOS project -> Framework -> Library instead of having the library in both the project and the framework.
I have tried adding the static library as a resource in the framework, but it didn't work.
I doubt this is possible. When you think about what is happening you will see the problem.
The framework is compiled and the static library is processed so that things like extra symbols are stripped out
The app is now compiled and linked against the framework which may or may not have had the symbols that the app is requiring
I did get this to work if ONLY the framework was using the static library (logical) but I can't find a way to share the code across the framework & the app.
If a symbol is hidden (either via Symbols Hidden by Default/GCC_SYMBOLS_PRIVATE_EXTERN being set to YES or __attribute__ ((visibility ("hidden"))) being applied to certain symbols), then that symbol will be available when statically linking the library, but not when dynamically linking the framework.
Ensure that the static library's symbols are not hidden, and you should be able to access them from your app.
I have followed this link to create custom framework. I have static library inside my framework and it works fine with that.
I have copied his steps in my blog for my understanding along with a script to make it universal.

Soundtouch bpm iPhone

I'm trying to integrate a mechanism to calculate the BPM of the song in the iPod library(also on iphone).
Searching on the web I found that the most used and reliable libraries to do this things is soundtouch.Anyone has experience with this library? It is computationally possible to make it run on the iPhone hardware?
I have recently been using the code from the BPMDetect class of the soundtouch library succesfully. Initially compiled it on C++, later on translated the code to C# and lately I've been using the C++ code on an Android app through JNI. I'm not really familiar with development in iOS but I'm almost certain that it is possible what you're trying to do.
The only files you should use from the soundtouch source code are the following:
C++ files
BPMDetect.cpp
FIFOSampleBuffer.cpp
PeakFinder.cpp
Header files
BPMDetect.h
FIFOSampleBuffer.h
FIFOSamplePipe.h
PeakFinder.h
soundtouch_config.h
STTypes.h
At least these are the only ones I had to use to make it work.
The BPMDetect class recieves raw samples through its inputSamples() method, it's capable of calculating a bpm value even when the whole file is not yet loaded into its buffer. I have found that these intermediate values differ from the one obtained once the whole file is loaded, which is more accurate, in my experience.
Hope this helps.
EDIT:
It's a kind of complex process to explain in a comment so I'm going to edit the answer.
The gist of it is that you need your android app to consume native code. In order to do that, you need to compile the files listed above from the soundtouch library with the Android NDK toolset.
That will leave you with native code that will be able to process raw sound data, but you still need to get the data from the sound file, which you can do several ways, I think. The way I was doing it was using the FMOD library for Android, here's a nice example for that: FMOD for Android.
Supposing you declared a method like this in your C code:
void Java_your_package_YourClassName_cPlay(JNIEnv *env, jobject thiz)
{
sound->play();
}
On the Android app you use your native methods in the following way:
public class Sound {
// Native method declaration
private native void cPlay();
public void play()
{
cPlay();
}
}
In order to have a friendlier API to work with you can create wrappers around these function calls.
I put the native C code I was using in a gist here.
Hope this helps.

How to use omnigroup framework in an iOS project?

I need to be able to write and read from a rtf file in iOS.
The omnigroup framework has the 2 classes i am looking for :
OmniUI/iPad/RTF/OUIRTFReader
OmniUI/iPad/RTF/OUIRTFWriter
I managed to build the frameworks but i cant figure out how to integrate theses classes in my own project.
I had the following frameworks to my project :
OmniAppKit.framework
OmniFoundation.framework
OmniBase.framework
I still get some undefined identifier such as :
RCS_ID("$Id$");
OBINITIALIZE
OMNI_POOL_START
Has anybody been able to use the omnigroup framework in your own project ?
Thanks,
Vincent
We do need some better documentation for this, but the TextEditor example app in OmniUI/iPad/Examples/TextEditor may be a good starting point for seeing how we include the frameworks in our apps.
In this particular case, you may prefer to pull out the OUIRTFReader class and any dependencies it needs from OmniAppKit and OmniFoundation into your project. updating the #imports to be "..." instead of <OmniThis/AndOmniThat.h>.
Perhaps you could try following the instructions given as part of this thread on the Omni Group forums. They appear to have been able to build the framework under the iOS 4.2 SDK.
I don't think you want the OmniAppKit framework, as that is just for the Mac.