小编ahy*_*dev的帖子

将数据写入Swift 3中的NSOutputStream

这个问题的解决方案不再适用于Swift 3.

不再有一个属性bytesData(前身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)

你怎么能写DataNSOutputStream斯威夫特3?

foundation nsdata nsoutputstream swift swift3

10
推荐指数
3
解决办法
1万
查看次数

UITableViewController不会调用cellForRowAtIndexPath但是numberOfSectionsInTableView和numberOfRowsInSection确实设置得当

#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)

iphone objective-c uitableview ios

5
推荐指数
2
解决办法
8247
查看次数

有没有办法在最新的Swift 3快照中使用C variadic函数?

一个例子是 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不支持这个吗?

ioctl swift swift3

5
推荐指数
1
解决办法
503
查看次数