[ 
https://issues.apache.org/jira/browse/CB-13824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16344672#comment-16344672
 ] 

ASF GitHub Bot commented on CB-13824:
-------------------------------------

tripodsan closed pull request #45: CB-13824: (osx) Swift 4 support
URL: https://github.com/apache/cordova-osx/pull/45
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/CordovaLib/CordovaLib/Classes/CDVViewController.m 
b/CordovaLib/CordovaLib/Classes/CDVViewController.m
index c310403..d43c0f3 100644
--- a/CordovaLib/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/CordovaLib/Classes/CDVViewController.m
@@ -304,6 +304,12 @@ - (id) getCommandInstance:(NSString*) pluginName {
     id obj = self.pluginObjects[className];
     if (!obj) {
         obj = [(CDVPlugin*) [NSClassFromString(className) alloc] 
initWithWebView:webView];
+        if (!obj) {
+            NSString* fullClassName = [NSString stringWithFormat:@"%@.%@",
+                                       
NSBundle.mainBundle.infoDictionary[@"CFBundleExecutable"],
+                                       className];
+            obj = [(CDVPlugin*) [NSClassFromString(fullClassName) alloc] 
initWithWebView:webView];
+        }
 
         if (obj != nil) {
             [self registerPlugin:obj withClassName:className];


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


>  (Swift 4) Plugin class not found
> ---------------------------------
>
>                 Key: CB-13824
>                 URL: https://issues.apache.org/jira/browse/CB-13824
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-ios, cordova-osx
>            Reporter: Alberto Lalama
>            Assignee: Tobias Bocanegra
>            Priority: Minor
>
> After upgrading to Xcode 9.2 (Swift 4), some plugins were not found. Plugin 
> method execution fails with the following message: "CDVPlugin class X 
> (pluginName: Y) does not exist".
> Closer inspection reveals that NSClassFromString returns nil for plugins 
> implemented in Swift. Prefixing the class with the module name fixes the 
> issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to