DSBridge-IOS icon indicating copy to clipboard operation
DSBridge-IOS copied to clipboard

请问支持swift的吗?

Open ccjsmile opened this issue 6 years ago • 10 comments

如果支持,swift中func如何写呢?

ccjsmile avatar Sep 29 '17 06:09 ccjsmile

可以的,我是这么写的,可以调用

    @objc func testSyn( _ args:Dictionary<String,Any>) -> String {
        let msg = args["msg"] as? String ?? ""
        return String(format:"%@[sync call:%@]", msg, "test")
    }
    
   @objc func testAsyn( _ args:Dictionary<String,Any>, handler: (String, Bool)->Void) {
        let msg = args["msg"] as? String ?? ""
        handler(String(format:"%@[async call:%@]", msg, "test"), true)
    }

编辑信息:第一个参数名前必须加下划线来强制忽略参数名,并且必须添加“@objc”

编辑:@wendux

yikuo123 avatar Oct 27 '17 06:10 yikuo123

Swift 要加@objc

    @objc func testSyn( _ args:Dictionary<String,Any>) -> String {
        let msg = args["msg"] as? String ?? ""
        return String(format:"%@[sync call:%@]", msg, "test")
    }
    
   @objc func testAsyn( _ args:Dictionary<String,Any>, handler: (String, Bool)->Void) {
        let msg = args["msg"] as? String ?? ""
        handler(String(format:"%@[async call:%@]", msg, "test"), true)
    }

编辑信息:第一个参数名前必须加下划线来强制忽略参数名

编辑:@wendux

hisoka0917 avatar Jan 23 '18 13:01 hisoka0917

if you're using dsBridge >=v3.0, you can write code as follows:

    @objc func testSyn( _ arg:String) -> String {
        return String(format:"%@[sync call:%@]", arg, "test")
    }

   @objc func testAsyn( _ arg:String, handler: (String, Bool)->Void) {
        handler(String(format:"%@[async call:%@]", arg, "test"), true)
   }

第一个参数必须添加下划线"_"来强制忽略参数

:octocat: From gitme Android

wendux avatar Feb 07 '18 08:02 wendux

我们的APP 运用了你们的框架导致被拒绝,理由如下: Guideline 2.5.2 - Performance - Software Requirements

Your app, extension, or linked framework appears to contain code designed explicitly with the capability to change your app’s behavior or functionality after App Review approval, which is not in compliance with App Store Review Guideline 2.5.2 and section 3.3.2 of the Apple Developer Program License Agreement.

This code, combined with a remote resource, can facilitate significant changes to your app’s behavior compared to when it was initially reviewed for the App Store. While you may not be using this functionality currently, it has the potential to load private frameworks, private methods, and enable future feature changes. This includes any code which passes arbitrary parameters to dynamic methods such as dlopen(), dlsym(), respondsToSelector:, performSelector:, method_exchangeImplementations(), and running remote scripts in order to change app behavior and/or call SPI, based on the contents of the downloaded script. Even if the remote resource is not intentionally malicious, it could easily be hijacked via a Man In The Middle (MiTM) attack, which can pose a serious security vulnerability to users of your app.

The next submission of this app may require a longer review time, and this app will not be eligible for an expedited review until this issue is resolved.

Next Steps

  • Review the Software Requirements section of the App Store Review Guidelines.
  • Ensure your app is compliant with all sections of the App Store Review Guidelines and the Terms & Conditions of the Apple Developer Program.
  • Once your app is fully compliant, resubmit your app for review.

Submitting apps designed to mislead or harm customers or evade the review process may result in the termination of your Apple Developer Program account. Review the Terms & Conditions of the Apple Developer Program to learn more about our policies regarding termination.

If you believe your app is compliant with the App Store Review Guidelines, you may submit an appeal. Alternatively, you may provide additional details about your app by replying directly to this message.

liyadonghtu avatar Apr 26 '18 01:04 liyadonghtu

@liyadonghtu 你是第一个反馈过不了审的,dsbridge里面确实使用了performSelector,但我想苹果的审核策略不会是用了这个函数就不能过审吧,这样的话ios中的反射也基本不能用了。你们现在是什么状况?申诉了吗?

wendux avatar May 04 '18 12:05 wendux

@liyadonghtu 请问现在审核如何了。我准备打算用这个框架

LiuSky avatar May 15 '18 03:05 LiuSky

@liyadonghtu 结果如何啊?我们公司也在考虑用这个框架,你这一说怕怕的。

hz0324 avatar Jun 06 '18 01:06 hz0324

诸位很抱歉,近来没关注大家对我的issue的疑问,在此做个申明吧, 首先我必须说明下我们APP的架构问题,我们应老板需求,采用了一次非常大胆的方案,整个APP就一个webview,所有内容部分用的都是js写的,只有js试下不了的功能采用native代码实现供web调用,我们尝试了很多次,都因为很多原因没能上架。 所以在此我要向DSBridge道歉,我们APP本身存在问题,并非证明因为DSBridge. DSBridge对大家伙的贡献有目共睹,用不着我过多赘述,相信大家内心最多的都是感谢。也相信即使大家反馈真有问题,DS团队也会在新版本中解决。 现在我们鉴于很多原因已经放弃了纯webAPP的开发。所以没有继续尝试上架。

liyadonghtu avatar Jul 06 '18 12:07 liyadonghtu

请问有完整的swfit实例吗

hesihan avatar Jan 06 '22 02:01 hesihan

几年了,为啥不计划出个纯Swift版本的

MYXYS avatar Jan 04 '23 09:01 MYXYS