OSGI Bundle's start() method is not getting called - osgi

I have few bundles with activator in my environment. In just one of the bundle start() method is not getting called. Basically it is not getting activated. The only change this bundle is having is, it is using "DynamicImport-Package: ".
Removing this tag solves the problem with start() not getting called but this is not possible as all the packages are not known upfront in my scenario.
Can somebody help me, as I am quite stuck with this.
I can not figure out whats the problem and how they two are related.

They are not related. Removing DynamicImport-Package will have no effect on whether your bundle starts, so something else must be going on. Do you actually call the Bundle.start() method on the bundle anywhere?
Incidentally, using DynamicImport-Package is a very very bad idea. There is almost certainly a much better way to solve whatever problem you think is solved by using DI-P.

When using DynamicImport-Package especially with * you cannot control where a package is drawn from. So you will have big problems if two bundles export the same package.
For example I had a problem with pax exam that uses this * import for test bundles and there where two versions of the package javax.inject. As their bundle calling the test saw a different version of the package the service imports did not work.
So in your example it could be possible that you have two versions of the package org.osgi.framework where the interface BundleActivator is located.
Do you install the org.osgi.core api bundle? If yes then remove it. Only the framework should provide these packages. It could cause the effect that the framework can not use your activator class.

Related

How to fix: Class PFLogger is implemented in both / Class PFFile is implemented in both

When I run my Workspace on the simulator I get the message
"Class PFFile/ PFLogger is implemented in both (Path) and (Path). One of the two will be used. Which one is undefined."
I don't know how to solve this problem. I already tried cleaning and resetting.
objc[7398]: Class PFFile is implemented in both
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/PhotoFoundation.framework/PhotoFoundation (0x11fdaf1b8)
and
/Users/Sven/Library/Developer/CoreSimulator/Devices/20F88AC5-6C5F-4492-8324-9205B54FB32C/data/Containers/Bundle/Application/8DD1D026-2D96-49E1-A485-6FCBD9899005/FitTip.app/Frameworks/Parse.framework/Parse (0x108c27408).
One of the two will be used. Which one is undefined.
objc[7398]: Class PFLogger is implemented in both
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/PhotoFoundation.framework/PhotoFoundation (0x11fdaff28)
and
/Users/Sven/Library/Developer/CoreSimulator/Devices/20F88AC5-6C5F-4492-8324-9205B54FB32C/data/Containers/Bundle/Application/8DD1D026-2D96-49E1-A485-6FCBD9899005/FitTip.app/Frameworks/Parse.framework/Parse (0x108c279f8).
One of the two will be used. Which one is undefined.
Cause
You're seeing this error because both Parse and PhotoFoundation have files named PFFile and PFLogger. In Objective-C, your program cannot have two classes that share the same class name. This is part of the reason why Apple advocates using a three letter prefix for your own class names. Apple's own frameworks always use two letter prefixes, hence PhotoFoundation related classes have a PF prefix.
Unfortunately in this case, Parse also chose to use the PF prefix across all of the classes in the library that they built. In isolation this won't cause a problem, but when other frameworks come into the picture there's a risk of namespace collisions (which is exactly what's happening here).
Solution
You avoid a namespace collision by simply making sure you don't use the same names. In your case, you don't own either of these classes so it's not as straightforward. Luckily this issue was already reported on the Parse SDK GitHub page and the fix was implemented on the latest version of the Parse SDK (1.17.2). Parse's PFFile and PFLogger were renamed to PFFileObject and PFSystemLogger respectively.
You probably have an older version of the Parse SDK installed in your project. This can be verified by going into the root folder of the project and opening up Podfile.lock in any text editor. You can see what version of the library is currently installed by CocoaPods. Run pod update Parse and CocoaPods should update it to the latest version.
TL;DR pod update Parse. If that fails: pod repo update, pod install
Slightly different problem. Etrecheck pointed out this problem:
Class MDSPathFilter is implemented in both /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata (0x7fff9a7d1420)
and /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Support/mdbulkimport (0x10ad41948)
One of the two will be used. Which one is undefined.
I am not proficient in this stuff, but able to follow directions if anyone has any to share. They both look too important to poke at ...

Aurelia CLI and braintree-web

I am trying to use https://www.npmjs.com/package/braintree-web with Aurelia (using the aurelia-cli and RequireJS). I am stuck trying to get all the many dependencies to resolve.
To use 3rd party library in Aurelia the library must be defined in the aurelia.json file.
If I add "braintree-web" in that file then aurelia complains that "braintree-web" it requires the modules "american-express", "apple-pay" etc etc.
If I manually create the "american-express", "apple-pay" dependencies then each one also refers to "braintree-web/lib", and a bunch of other sub-directory dependencies.
In short I can't get the "braintree-web" module to load because I have to manually build all sub-dependencies and its too complex to get working.
As I state above, I am using requireJS, should these dependencies all resolve correctly?
Any ideas as to how I can get this working?
Thanks
If all dependencies is what you need, then with requirejs + aurelia-cli you'll have to declare all dependencies. There is an experimental version of the cli being developed which you can find here, where you won't have to declare any dependencies in aurelia.json anymore.
With webpack you also don't need to declare any dependencies by the way.
Do you really need everything though? The docs mention for example you could import just the client. Still looks like a whole heap of dependencies, but at least a lot less than importing the main index.js.
You could also just include their pre-bundled client which I believe is https://js.braintreegateway.com/web/3.32.1/js/client.min.js
On a side note, the person developing aforementioned experimental CLI is actually looking for people to test it with non-trivial apps. Me and several others have tried it with great results, so I can recommend you try it. If you could report back in the PR that would be really awesome.

Sierra Mail Plugin

A client of mine who has a Mail plugin ("unofficial" of course since Apple does not provide support for mail plugin) wants me to update its pluginto Sierra.
When I look at the code swizzled, I see that one of the main classes he used is the SignatureBundle, which inherits from MVMailBundle. In this class, we can find many signature related functions like addSIgnature, signatureWithId and accountsEmails.
My problem is that this class no longer exists on Sierra, and I can't find any other class that I can use.
Do you have any clue that would help me figure out who to update his plugin? I know it is not official SDK, but who knows, maybe one of you already tried to update a mail plugin
Thanks for your help
As you rightly say, the SignatureBundle class is no longer present inside Mail's main executable. Such is life when you are using undocumented classes. :-)
Best advice I can give you is to take a look at the Mail-related frameworks inside /System/Library/PrivateFrameworks. If you are lucky, Apple may have simply moved this class into one of the private frameworks. However, if you are using NSClassFromString to find the class and getting nil back, then you're probably out of luck.
In which case, it's a long, tedious trawl around in the innards looking for the exact functionality you want. Your best bet in this case is Mail.framework itself. It contains a couple of hopeful-looking classes called MFSignature and MFSignatureManager. Some disassembly required...

Xcode iOS Unit Testing: Class is implemented in both. One of the two will be used. Which one is undefined

I'm trying to test my app which uses a cocoapod. The tests won't run without me adding the cocoapod to the test target in the pod file, but when I do that, it produces the following error:
Class ~ is implemented in both ~AppTarget and ~AppTests. One of the two will be used. Which one is undefined.
This error essentially means Xcode doesn't doesn't know which pod to use, the one from the app target or the test target, which makes sense since the pod may be different versions or have different functionality.
I am using Quick and Nimble for testing, so my imports look like the following:
import Quick
import Nimble
import ~AppTarget
There is a related question:
"ios-unit-testing-class-is-implemented-in-both", but the answer there doesn't help.
Does someone have a suggestion how to fix this?
Thanks in advance!

Resolving imports not found errors in Flex/Adobe Flash Builder

I am very new to Flex/Adobe FlashBuilder and I am running into an "import not found" error. Coming from a Java background, I understand this is more of a question of importing the equivalent of *.jar files in Flex/Flash. But how exactly I should go about resolving this, I am unaware.
Anybody want to help and get some points :) ?
If you're a beginner probably everything you import is included is Flex framework or is made by you. If you import your own classes remember to preserve package in their names (if the come from different package). Check classes names for spelling errors.
When using class in code you can use content assist (Ctrl+Space), then imports will be added automatically.
You can also check what quickfix lightbulb says (it's the same as in Eclipse as FBuilder is based on it).
You can make your question much better by including the code that causes the error.

Resources