我仍然很擅长使用swift和json,我正在努力解决以下问题并在行上收到错误消息:let param = jsonObj.dataUsingEncoding(NSUTF8StringEncoding)。错误是: - 类型'String:NSString'的值没有dataUsingEncoding
<Window x:Class="WpfTutorialSamples.Styles.StyleTriggersSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="StyleTriggersSample" Height="100" Width="300">
<Grid>
<TextBlock Text="Hello, styled world!" FontSize="28" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Blue"></Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Red" />
<Setter Property="TextDecorations" Value="Underline" />
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Window>
如果有人可以帮助我并说出问题所在,我会非常感激。
由于
答案 0 :(得分:0)
方法.dataUsingEncoding对于String类型是存在的,你必须不是[String:NSString]字典,而是字符串。 所以你这样做:
// normally you do not return void but a Task BUT with WPF events
// (like on button click) void is required instead
protected async void MyMethod() {
// Task.WaitAll(tasks); // replace this with
await Task.WhenAll(tasks); // this will not hang your UI
// rest of your code that you want to execute
}