nsstring

xcode unknown type name

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I got code like this: Match.h: #import #import "player.h" @interface Match : NSObject { Player *firstPlayer; } @property (nonatomic, retain) Player *firstPlayer; @end Player.h: #import #import "game.h" @interface Player : NSObject { } - (Player *) init; //- (NSInteger)numberOfPoints; //- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil; @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *surname; @property (nonatomic, assign) NSInteger *player_id; @property (nonatomic, retain)

UITableview Cell exception - 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using the UITableView. CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink]; This is the line I am getting the error. It is working in IOS 7. But when I run the application in IOS 8 I am getting the error ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES. EDIT Full code - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static

How to convert wchar_t to NSString?

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have wchar_t buffer [100] . Sometimes it needed for Unicode letters, sometimes is not. I need to convert it to NSString. I'm using NSString *str = [NSString string:(char *)buffer]; to conver it. When I'm trying to NSLog my NSString, sometimes it getting right result, but sometimes is not. Did I miss something? Thanks! 回答1: Everything is as Totumus Maximus has said, but additionally you need to know how the characters in your buffer are encoded. As wchar_t is 32 bits you probably have some 32 bit encoding of which UTF32-LE is the most

IOS : NSString retrieving a substring from a string

亡梦爱人 提交于 2019-12-03 01:36:06
Hey I am looking for a way to extract a string from another string. It could be any length and be in any part of the string so the usual methods don't work. For example http://bla.com/bla?id=%1234%&something=%888% What I want to extract is from id=% to the next %. Any idea's? Use the rangeOfString method: NSRange range = [string rangeOfString:@"id=%"]; if (range.location != NSNotFound) { //range.location is start of substring //range.length is length of substring } You can then chop up the string using the substringWithRange: , substringFromIndex: and substringToIndex: methods to get the bits

How to check if a directory exists in Objective-C

匿名 (未验证) 提交于 2019-12-03 01:35:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I guess this is a beginner's problem, but I was trying to check if a directory exists in my Documents folder on the iPhone. I read the documentation and came up with this code which unfortunately crashed with EXC_BAD_ACCESS in the BOOL fileExists line: -(void)checkIfDirectoryAlreadyExists:(NSString *)name { NSFileManager *fileManager = [[NSFileManager alloc] init]; NSString *path = [[self documentsDirectory] stringByAppendingPathComponent:name]; BOOL fileExists = [fileManager fileExistsAtPath:path isDirectory:YES]; if (fileExists) { NSLog(@

Drag Files come across Sandbox(__CFPasteboardIssueSandboxExtensionForPath)

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I processed drag operation from browser view to custom view.It work well in snow lepoard,but not in Mountain Lion with sandbox. in browser view: NSMutableArray* urls = [[[NSMutableArray alloc] init] autorelease]; ..............put some NSUrl to urls array.................... [pasteboard writeObjects:[NSArray arrayWithArray:urls]]; in my receive custom view: NSArray* pasteboardItems = [pasteboard readObjectsForClasses:[NSArray arrayWithObject:[NSString class]] options:nil]; NSArray* pasteboardItems2 = [pasteboard readObjectsForClasses:

Twitter API “retweeted_status” field in “home_timeline” request

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm using MGTwitterEngine + OAuth in my iPhone application. All works fine, but when I'm requesting home_timeline of friends_timeline with include_rt option I'm not getting retweeted_status field. dev.twitter.com/doc/get/statuses/home_timeline Responce should contain "retweeted_status" structure for retweets (as you can see in the sample). It describes source tweet that was retweeted. dev.twitter.com/console If you will use Twitter Console - you will get this structure successfully. But my app recieves this structure as empty. Like

Capitalize or change case of an NSString in Objective-C

匿名 (未验证) 提交于 2019-12-03 01:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I was wondering how to capitalize a string found in an object in an NSMutableArray . An NSArray contains the string 'April' at index 2. I want this to be changed to 'APRIL' . Is there something simple like this? viewNoteDateMonth . text = [[ displayDate objectAtIndex : 2 ] capitalized ]; 回答1: Here ya go: viewNoteDateMonth . text = [[ displayDate objectAtIndex : 2 ] uppercaseString ]; Btw: "april" is lowercase [NSString lowercaseString] "APRIL" is UPPERCASE [NSString uppercaseString] "April May" is Capitalized/Word Caps [NSString

static NSString usage vs. inline NSString constants

馋奶兔 提交于 2019-12-03 01:28:54
问题 In Objective-C, my understanding is that the directive @"foo" defines a constant NSString. If I use @"foo" in multiple places, the same immutable NSString object is referenced. Why do I see this code snippet so often (for example in UITableViewCell reuse): static NSString *CellId = @"CellId"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellId]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:style reuseIdentifier:CellId]; Instead of just:

JSON parsing error

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to parse some JSON. I've passed a constant key value and a string - butI'm receivng 16 objects in the statuses array and 20 objects in ststuses1 . Are any of the parsing steps wrong? I have included the code for the JSON parser. Thanks in advance. SBJSON * parser = [[ SBJSON alloc ] init ]; NSString * urlString =[ NSString stringWithFormat :@ "http://api.shiki.com/api/serch?key=%@&q=%@" , apiKey , string ]; NSURL * url = [ NSURL URLWithString : urlString ]; NSURLRequest * request = [[ NSURLRequest alloc ] initWithURL :