Skip to content

Commit

Permalink
fix wendux#40
Browse files Browse the repository at this point in the history
  • Loading branch information
duwen committed Sep 6, 2018
1 parent 79519e1 commit e2c6751
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 26 deletions.
Binary file modified Build/Products/Debug-iphonesimulator/libdsbridge.a
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "dsbridgedemo/JsApiTest.m"
timestampString = "557916051.373858"
filePath = "dsbridge/DWKWebView.m"
timestampString = "557920558.736751"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "22"
endingLineNumber = "22"
landmarkName = "-testSyn:"
startingLineNumber = "256"
endingLineNumber = "256"
landmarkName = "-call::"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
Expand All @@ -234,11 +234,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "dsbridge/DWKWebView.m"
timestampString = "557916051.373956"
timestampString = "557920558.736854"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "256"
endingLineNumber = "256"
startingLineNumber = "251"
endingLineNumber = "251"
landmarkName = "-call::"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -250,11 +250,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "dsbridge/DWKWebView.m"
timestampString = "557916051.37403"
timestampString = "557920558.736935"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "251"
endingLineNumber = "251"
startingLineNumber = "250"
endingLineNumber = "250"
landmarkName = "-call::"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -266,11 +266,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "dsbridge/DWKWebView.m"
timestampString = "557916051.374078"
timestampString = "557920558.737004"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "250"
endingLineNumber = "250"
startingLineNumber = "259"
endingLineNumber = "259"
landmarkName = "-call::"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -282,11 +282,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "dsbridge/DWKWebView.m"
timestampString = "557916051.374128"
timestampString = "557920558.737074"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "259"
endingLineNumber = "259"
startingLineNumber = "248"
endingLineNumber = "248"
landmarkName = "-call::"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -298,11 +298,27 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "dsbridge/DWKWebView.m"
timestampString = "557916051.374173"
timestampString = "557920558.737144"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "248"
endingLineNumber = "248"
startingLineNumber = "267"
endingLineNumber = "267"
landmarkName = "-call::"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "dsbridge/DWKWebView.m"
timestampString = "557920558.737913"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "264"
endingLineNumber = "264"
landmarkName = "-call::"
landmarkType = "7">
</BreakpointContent>
Expand Down
7 changes: 6 additions & 1 deletion dsbridge/DWKWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,11 @@ -(NSString *)call:(NSString*) method :(NSString*) argStr
SEL sel=NSSelectorFromString(methodOne);
SEL selasyn=NSSelectorFromString(methodTwo);
NSDictionary * args=[JSBUtil jsonStringToObject:argStr];
NSString *arg=args[@"data"];
id arg=args[@"data"];
if(arg==[NSNull null]){
arg=nil;
}
//if(arg)
NSString * cb;
do{
if(args && (cb= args[@"_dscbstub"])){
Expand Down Expand Up @@ -293,6 +297,7 @@ -(NSString *)call:(NSString*) method :(NSString*) argStr
}

};

SuppressPerformSelectorLeakWarning(
[JavascriptInterfaceObject performSelector:selasyn withObject:arg withObject:completionHandler];

Expand Down
3 changes: 1 addition & 2 deletions dsbridgedemo/JsApiTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ @interface JsApiTest(){

@implementation JsApiTest

- (NSString *) testSyn:(NSString *) msg
- (NSString *) testSyn: (NSString *) msg
{
//return nil;
return [msg stringByAppendingString:@"[ syn call]"];
}

Expand Down
5 changes: 2 additions & 3 deletions dsbridgedemo/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@


function callSyn() {
alert(dsBridge.call("testSyn", "testSyn--"))
prompt("你好","默认文本")
alert(dsBridge.call("testSyn", "hello"))
}

function callAsyn() {
dsBridge.call("testAsyn","testAsyn--", function (v) {
dsBridge.call("testAsyn","hello", function (v) {
alert(v)
})
}
Expand Down

0 comments on commit e2c6751

Please sign in to comment.