cs193p

_BSMachError while running Stanford's CS193p Smashtag app

我是研究僧i 提交于 2019-12-04 17:52:53
问题 I downloaded the Smasthag demo app from course's site. Project builds fine (after small changes in Twitter, TwitterRequest etc. classes, because I use the latest Xcode 7b4) and works fine on simulator (I also had to add NSAppTransportSecurity key to info.plist ), but not on a device - it doesn't fetch tweets . I tested it on both iPhone 6 with iOS 9 Public Beta and iPad 2 with iOS 8.4. Moreover, when app is running in the simulator and I change hashtag to search, whole tableView reloads with

How can I create a variable sized UITableViewCell?

拟墨画扇 提交于 2019-12-04 07:48:41
问题 I can't seem to get the text to actually span multiple lines. The heights look correct. What am I missing? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"StatusCell"] autorelease]; CGRect frame = cell.contentView.bounds; UILabel *myLabel = [[UILabel alloc] initWithFrame:frame]; myLabel.text = [[person.updates objectAtIndex:indexPath.row]

<unknown>:0: error: unexpected input file:

柔情痞子 提交于 2019-12-04 03:06:35
I downloaded files from a separate Stack OverFlow post, and dragged the folder into my project (as a group.) The dependancies get resolved and it shows no error for code that relies on the files, but when I try to compile I get this error: <unknown>:0: error: unexpected input file: /.../xyz.Swift Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1 It might be nothing, but the files themselves in the project navigator show up as blank icons (while my project's other file have the swift red spalsh icon) despite checking in

How can I create a variable sized UITableViewCell?

狂风中的少年 提交于 2019-12-02 16:52:53
I can't seem to get the text to actually span multiple lines. The heights look correct. What am I missing? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"StatusCell"] autorelease]; CGRect frame = cell.contentView.bounds; UILabel *myLabel = [[UILabel alloc] initWithFrame:frame]; myLabel.text = [[person.updates objectAtIndex:indexPath.row] valueForKey:@"text"]; [cell.contentView addSubview:myLabel]; [myLabel release]; return cell; } - (CGFloat

Why UILabel is not initialized?

回眸只為那壹抹淺笑 提交于 2019-12-01 00:48:17
The code is from Stanford CS193p. I added a NSLog to check it out. The label seems not being initialized. Any idea? @interface AskerViewController() <UITextFieldDelegate> @property (weak, nonatomic) IBOutlet UILabel *questionLabel; @property (weak, nonatomic) NSString *question; @end @implementation AskerViewController @synthesize questionLabel = _questionLabel; @synthesize question = _question; - (void)setQuestion:(NSString *)question { _question = question; self.questionLabel.text = question; NSLog(@"label is %@", self.questionLabel); } @end The NSLog result is: 2012-07-31 01:56:45.177

‘CGFloat’ is not convertible to ‘UInt8' and other CGFloat issues with Swift and Xcode 6 beta 4

喜你入骨 提交于 2019-11-28 12:00:49
In case this illuminates the problem, here's the original Objective-C code. int x = (arc4random()%(int)(self.gameView.bounds.size.width*5)) - (int)self.gameView.bounds.size.width*2; int y = self.gameView.bounds.size.height; drop.center = CGPointMake(x, -y); I started out with this code. Lines 2 and 3 are fine, I'm presenting them for clarity later. let x = CGFloat(arc4random_uniform(UInt32(self.gameView.bounds.size.width * 5))) - self.gameView.bounds.size.width * 2 let y = self.gameView.bounds.size.height dropView.center = CGPointMake(x, -y) In Xcode 6 beta 3, it was necessary to cast the

How do I create a global UIManagedDocument instance per document-on-disk shared by my whole application using blocks?

允我心安 提交于 2019-11-28 07:41:26
I am trying to design a helper method which will retrieve a UIManagedDocument, then open and return it, so that I may access the same UIManagedDocument from several places in my app. I am having trouble with the asynchronous nature of this as I am not too familiar with blocks. Ideally the sequence of events would be this: Class X calls the helper method to retrieve the UIManagedDocument and includes a block of code to run when the opened document is returned. The class method retrieves the UIManagedDocument and calls openWithCompletionHandler or saveToURL as necessary, and includes a block of

‘CGFloat’ is not convertible to ‘UInt8' and other CGFloat issues with Swift and Xcode 6 beta 4

别说谁变了你拦得住时间么 提交于 2019-11-27 06:40:11
问题 In case this illuminates the problem, here's the original Objective-C code. int x = (arc4random()%(int)(self.gameView.bounds.size.width*5)) - (int)self.gameView.bounds.size.width*2; int y = self.gameView.bounds.size.height; drop.center = CGPointMake(x, -y); I started out with this code. Lines 2 and 3 are fine, I'm presenting them for clarity later. let x = CGFloat(arc4random_uniform(UInt32(self.gameView.bounds.size.width * 5))) - self.gameView.bounds.size.width * 2 let y = self.gameView

How do I create a global UIManagedDocument instance per document-on-disk shared by my whole application using blocks?

ⅰ亾dé卋堺 提交于 2019-11-27 02:02:03
问题 I am trying to design a helper method which will retrieve a UIManagedDocument, then open and return it, so that I may access the same UIManagedDocument from several places in my app. I am having trouble with the asynchronous nature of this as I am not too familiar with blocks. Ideally the sequence of events would be this: Class X calls the helper method to retrieve the UIManagedDocument and includes a block of code to run when the opened document is returned. The class method retrieves the