rentzsch / mach_inject

interprocess code injection for Mac OS X
823 stars 160 forks source link

using mach_inject in xamarin.mac #15

Open karthickr87 opened 10 years ago

karthickr87 commented 10 years ago

Hello,

I am using xamarin for developing a mac application, my idea is to create a binding between mach_inject and xamarin. As a first step, i created a framework out of this project.To make sure it is working fine, i created a new xcode project and linked the framework. When i run the app, i am getting the following error

2014-10-31 17:58:27.429 BrainloopShareFramework[11184:303] an error occurred while installing com.aspiresys.BrainloopShareFramework.Installer (domain: kSMErrorDomainFramework (4097)) 2014-10-31 17:58:27.430 BrainloopShareFramework[11184:303] Couldn't install MachInjectSample (domain: com.erwanb.MachInjectSample.ErrorDomain code: 1)

Am i going in correct approach. is it possible to use mach_inject in xamarin mac app by creating a binding. Please help me.

rodionovd commented 9 years ago

Well, the reason for the error is that SMJobBless() doesn't play well with frameworks: it expects your helper executable to lay inside your main application bundle (and not inside your framework's bundle).

There're few things you can do here:

  1. Copy your helper into Contents/Library/LaunchServices directory of the application bundle;

    You may even do that at runtime: see how I did it for my own injection framework

  2. (if you're trying to inject something into Finder) try Finder Sync extensions instead. Even Dropbox replaced their Finder injector with them.

Don't also forget about code-signing: everything (your main application, frameworks and helpers) should share the same certificate.