nsmutablearray

Creating a highscore like system, iPhone side

不打扰是莪最后的温柔 提交于 2019-12-08 12:23:18
问题 I'm sorry for opening a new question, I had to - as I wrote the other question from my iPhone as unregistered user and it is not very comfortable to write from the iPhone. Rephrasing the question: Is it possible to use the: [NSMutableArray writeToURL:(NSString *)path atomically:(BOOL)AuxSomething]; In order to send a file (NSMutableArray) XML file to a url, and update the url to contain that file? for example: I have an array and I want to upload it to a specific URL and the next time the app

Filtering NSMutableArray of NSDictionary with NSPredicate

梦想与她 提交于 2019-12-08 11:43:02
问题 I'm having an NSObject entity for storing some data like name, id from server NSObject file looks like below, @interface MyEntity : NSObject @property(nonatomic,strong)NSString *userId; @property(nonatomic,strong)NSString *userName; - (id)initWithJSON:(NSDictionary *)dataDict; @end - (id)initWithJSON:(NSDictionary *)dataDict { if (self = [super init]) { self.userId = [dataDict objectForKeyNotNull:@"userId"] ; self.userName = [dataDict objectForKeyNotNull:@"userName"] ; } return self; } I'm

Error: Could not find overload for 'title' that accepts the supplied arguments

谁说胖子不能爱 提交于 2019-12-08 10:05:28
问题 Currently I have a subclass of NSManaged object called Folder with property called item that is of type NSSet . I have a function to return a NSMutableArray and I am trying to display the data in a tableview (and then rearrange the order displayed in the table). class Folder: NSManagedObject { @NSManaged var title: String @NSManaged var date: NSDate @NSManaged var item: NSSet func itemMutableArray() -> NSMutableArray { return NSMutableArray(array: (item.allObjects as! [Checklist]).sorted{ $0

How to create NSMutableArray of UILabels?

爷,独闯天下 提交于 2019-12-08 10:00:37
问题 I have a problem here. I'm creating UILabels dynamically to be displayed into a UIView. Here is the code: for (flower in flowerList) { // Create the Qty label CGRect rectQty = CGRectMake(x , y, 25, labelHeight); UILabel *flowerQuantityLabel = [[UILabel alloc] initWithFrame:rectQty]; NSString *fQty = [[NSString alloc] initWithFormat:@"%d", flower.flowerQty]; [flowerQuantityLabel setText:fQty]; // Loading refrence into a array // here is the problem [flowersQtyLabels addObject

Check the attribute of items in a directory in Objective-C

夙愿已清 提交于 2019-12-08 09:41:59
问题 I have made this little code to check how many subdirectories are in a given directory. It checks only the first level, is there anyway I can make it simplier? I have added comments, maybe easier to understand my intention. Thank you! #import < Foundation/Foundation.h > int main (int argc, const char * argv[]){ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; // insert code here... NSFileManager *filemgr; NSMutableArray *listOfFiles; NSDictionary *listOfFolders; NSDictionary

NSUserDefaults “Pause” / Crash on iOS8

一个人想着一个人 提交于 2019-12-08 08:48:59
问题 Ok, so I launched an app last week before iOS8 came out. Everything was working fine in iOS7 and below. But now since people have updated to iOS8 my app is pausing/crashing for no reason. I came to terms that it is when I set an NSMutableArray to the NSUserDefaults, it pauses. Please note, the NSMutableArray is an array of NSStrings. BUT (this is weird) if I breakpoint skip through the code it works and I get no pause. Here is the function that it is blowing up... -(void)UpdateMyAgenda:

How to compare two NSMutableArrays?

妖精的绣舞 提交于 2019-12-08 08:41:11
问题 I'm new to iOS development and having trouble comparing two NSMutableArray . One of them ( appDelegate.array in code) contains data coming from a database and another one ( dataArray in code) contains data coming from a server response. Now I want compare each element of ( dataArray ) with whole ( appDelegate.array ) and if some element of ( dataArray ) exist in ( appDelegate.array ) then do nothing or break and if doesn't exist then add it into database. I tried, but am unable to do this.

How to retrieve array in php sent from iOS

感情迁移 提交于 2019-12-08 08:28:24
问题 Following is my iOS code that sends NSmutable Array to PHP webservice: // Getting Server Address AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; NSString *serverAddress = [appDelegate getServerAddress]; serverAddress = [serverAddress stringByAppendingString:@"ABC.php"]; NSLog(@"Server Address: %@",serverAddress); NSData *post = [NSJSONSerialization dataWithJSONObject:UsersArray options:NSJSONWritingPrettyPrinted error:nil]; NSString *postLength = [NSString

Is Cocoa's NSMutableArray sparse?

一世执手 提交于 2019-12-08 06:28:19
问题 If I create an NSMutableArray that might have up to 2^16 elements, but will mostly be empty, will I be wasting space or is NSMutableArray implemented as a sparse array? 回答1: Elements in an NSArray can't be empty and there's no "default" value. To represent nil , you'd usually use the singleton [NSNull null] , which is still a reference to an object so it consumes memory (the pointer). I'd consider using NSDictionary (or NSMutableDictionary ) with numeric ( NSNumber ) keys instead. 回答2: No

How get objects from one array with same properties of other?

元气小坏坏 提交于 2019-12-08 06:03:44
问题 For example: I have two NSMutableArray . One @[1,2,3,4,5,6,7] . Other have objects like @[ @{@idObjectToSearch":1, @"name":@"aaaaa", @"surname": @"bbbbb"}, @{@idObjectToSearch":2, @"name":@"aaaaa", @"surname": @"ccccc"}, ... @{@idObjectToSearch":100, @"name":@"aaaaa", @"surname": @"cccdcd"} ]; So how I could extract needed objects from second array more effective way? 回答1: You need to use NSPredicate with your second array. NSPredicate *predicate = [NSPredicate predicateWithFormat:@