这个问题的解决方案不再适用于Swift 3.
不再有一个属性bytes的Data(前身NSData.
let data = dataToWrite.first!
self.outputStream.write(&data, maxLength: data.count)
Run Code Online (Sandbox Code Playgroud)
使用此代码,我收到错误:
Cannot convert value of type 'Data' to expected argument type 'UInt8'
Run Code Online (Sandbox Code Playgroud)
你怎么能写Data一NSOutputStream斯威夫特3?
#import "AssignmentsViewController.h"
#import "Assignment.h"
@interface AssignmentsViewController ()
@property NSMutableArray *assignments;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end
@implementation AssignmentsViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
NSLog(@"viewDidLoad");
[super viewDidLoad];
// Do any additional setup after loading the view.
self.assignments = [[MySingleton sharedMySingleton] assignments];
self.tableView.delegate = self;
self.tableView.dataSource = self;
}
- (void)viewWillAppear:(BOOL)animated {
NSLog(@"viewWillAppear");
[self.tableView reloadData];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// …Run Code Online (Sandbox Code Playgroud) 一个例子是 ioctl
error: 'ioctl' is unavailable: Variadic function is unavailable
Darwin.ioctl:2:13: note: 'ioctl' has been explicitly marked unavailable here
public func ioctl(_: Int32, _: UInt, _ varargs: Swift.Any...) -> Int32
Run Code Online (Sandbox Code Playgroud)
当它从C导入时,它似乎被正确标记为接受varargs.
是这样的吗?
为什么它会被明确标记为不可用?Swift 3.0不支持这个吗?
swift ×2
swift3 ×2
foundation ×1
ioctl ×1
ios ×1
iphone ×1
nsdata ×1
objective-c ×1
uitableview ×1