Skip to content

Commit

Permalink
fix bugs and add int128, int40 type support of ios (#106)
Browse files Browse the repository at this point in the history
Co-authored-by: Xingqang Bai <[email protected]>
Co-authored-by: Maggie WU <[email protected]>
  • Loading branch information
3 people authored Mar 23, 2021
1 parent a4526a2 commit 3539e11
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 128 deletions.
10 changes: 5 additions & 5 deletions abi/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,16 @@ func bindBasicTypeObjC(kind abi.Type) string {
switch parts[2] {
case "8", "16", "32":
return "int"
case "64":
case "40", "48", "56", "64":
return "double"
}
return "NSString *"
case abi.UintTy:
parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(kind.String())
switch parts[2] {
case "8", "16", "32":
return "unsigned int"
case "64":
return "int"
case "40", "48", "56", "64":
return "double"
}
return "NSString *"
Expand Down Expand Up @@ -391,7 +391,7 @@ func objcFormattedValue(kind abi.Type, valueName string, structs map[string]*tmp
case "8", "16", "32":
//return "[NSString stringWithFormat:@\"%d\", " + valueName + "]"
return "@(" + valueName + ")"
case "64":
case "40", "48", "56", "64":
//return "[NSString stringWithFormat:@\"%.0lf\", " + valueName + "]"
return "@(" + valueName + ")"
}
Expand All @@ -402,7 +402,7 @@ func objcFormattedValue(kind abi.Type, valueName string, structs map[string]*tmp
case "8", "16", "32":
//return "[NSString stringWithFormat:@\"%u\", " + valueName + "]"
return "@(" + valueName + ")"
case "64":
case "40", "48", "56", "64":
//return "[NSString stringWithFormat:@\"%.0lf\", " + valueName + "]"
return "@(" + valueName + ")"
}
Expand Down
7 changes: 6 additions & 1 deletion mobile/ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ go mod download
```bash
# 编译iOS SDK,当前目录~/go/src/github.com/FISCO-BCOS/go-sdk
export CGO_LDFLAGS_ALLOW=".*"
gomobile bind -target=ios -o FiscoBcosIosSdk.framework ./mobile/iOS
gomobile bind -target=ios -o FiscoBcosIosSdk.framework --ldflags='-s -w' :./mobile/ios
# 编译成功后,目录下会多了一个FiscoBcosIosSdk.framework目录
```

Expand Down Expand Up @@ -71,8 +71,13 @@ contract HelloWorld {

function set(string v) public {
value = v;

}
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
[alertController addAction:cancelAction];
[self presentViewController:alertController animated:YES completion:nil];
}

```

#### 第二步. 编译合约
Expand Down
Loading

0 comments on commit 3539e11

Please sign in to comment.