mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 07:52:12 +08:00
57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
|
|
# Troubleshooting
|
|
|
|
An assortment of troubleshooting tips.
|
|
|
|
## My application is displaying a white/blank screen
|
|
|
|
Check that your application includes the assets from the correct directory. In your `main.go` file, you will have
|
|
something similar to the following code:
|
|
|
|
```go
|
|
//go:embed frontend/dist
|
|
var assets embed.FS
|
|
```
|
|
Check that `frontend/dist` contains your application assets.
|
|
|
|
## Mac application not valid
|
|
|
|
If your built application looks like this in finder:
|
|
|
|
<p className="text--center">
|
|
<img src="/img/troubleshooting/invalid_mac_app.png"></img>
|
|
</p>
|
|
|
|
it's likely that your application's `info.plist` is invalid. Update the file in `build/<yourapp>.app/Contents/info.plist`
|
|
and check if the data is valid, EG check the binary name is correct. To persist the changes, copy the file back to
|
|
the `build/darwin` directory.
|
|
|
|
## Cannot call backend method from frontend with variadic arguments
|
|
|
|
If you have a backend method defined with variadic parameters, eg:
|
|
```go
|
|
func (a *App) TestFunc(msg string, args ...interface{}) error {
|
|
// Code
|
|
}
|
|
```
|
|
calling this method from the frontend like this will fail:
|
|
```js
|
|
var msg = "Hello: "
|
|
var args = ["Go", "JS"]
|
|
window.go.main.App.TestFunc(msg, ...args).then((result) => {
|
|
//do things here
|
|
}).catch((error) => {
|
|
//handle error
|
|
});
|
|
```
|
|
Workaround:
|
|
```js
|
|
var msg = "Hello "
|
|
var args = ["Go", "JS"]
|
|
window.go.main.App.TestFunc(msg, args).then((result) => { //without the 3 dots
|
|
//do things here
|
|
}).catch((error) => {
|
|
//handle error
|
|
});
|
|
```
|
|
Credit: https://github.com/wailsapp/wails/issues/1186 |