Tag: cocoa touch

Set Maximum Size for CGImageRef from ALAssetRepresentation

I am currently using the following code to get an UIImage from an ALAsset in an iOS app. ALAssetRepresentation *rep = [self.asset defaultRepresentation]; CGImageRef ref = [rep fullResolutionImage]; ALAssetOrientation orientation = [[self.asset valueForProperty:@”ALAssetPropertyOrientation”] intValue]; UIImage *image = [UIImage imageWithCGImage:ref scale:1.0 orientation:(UIImageOrientation)orientation]; This works very well as long as the image is reasonably small (e.g. taken […]

Is there any way to serialize / unserialize an Objective-C block?

I’m writing an app where support for “promotions” is required, and these promotions could be arbitrarily complex and many different pieces of data might be relevant in their calculation. Therefore, whilst in the early stages of development, I don’t want to invent a whole specification schema for these things, I’d rather just write each one […]

how to make NSManagedObjectContext dirty (hasChanges = YES) Manually

the problem is: while setting transient undefined attribute in -(void)didSave metod after first save: does not make context dirty in iOS 4.3 (Simulator), but makes it dirty in iOS 5.0 Simulator. I need the same behaviour in iOS 4.3. So – what is the cheapest way to make context dirty between 2 (BOOL)save: calls. Once […]

Cocoa KVC: “class is not key value coding-compliant”

I’m trying to update some properties with KVC. The properties have been synthesized. This line works: myObject.value = intValue; This doesn’t work: [self setValue:[NSNumber numberWithInt:intValue] forKey:@”myObject.value”]; And blows up with: Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<MyViewController 0xd1cec0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key myObject.value.’ Yet further up […]

Command /usr/bin/codesign failed with exit code 1: i386: No such file or directory

I have an error that just occurred. I think it was when I changed some of my build settings. I wanted my app to work with both armv6 and armv7. But now I get this error saying Command /usr/bin/codesign failed with exit code 1 and i386: No such file or directory. Here is the entire […]

long running REST API

A backend API I need to connect to takes about 3-4 minutes to return a response. The iOS client seems to timeout at exactly 60 seconds (which is the default), and I can’t figure out how to extend that time out. I have tried to set the timeoutInterval for the NSURLRequest to a large number, […]

Got error: FT_Open_Face failed: error 2

I am getting following error when i use CGContextDrawPDFPage(context, _PDFPage) for some files. Any work around to fix this issue? FT_Open_Face failed: error 2.

How do I easily strip just a comma from an NSString?

I have a UILabel with the following text: Medium, Black What I intended to do was grab the words in the string and insert each into a mutable array so I could use each title later on to identify something. Here’s how I done this: NSMutableArray *chosenOptions = [[[[cell tapToEditLabel] text] componentsSeparatedByString: @” “] mutableCopy]; […]

Screenshot that taken by iOS when (before) application go into background?

I hope that you all know about it, iOS takes screenshot before your application goes to background. I got it from official document. Remove sensitive information from views before moving to the background: When an app transitions to the background, the system takes a snapshot of the app’s main window, which it then presents briefly […]

I am sending dictionary in json and its have two array and multiple value but i am getting response access denied

I am sending two array and multiple value throw json but when i send this i am getting success code 200 and its response showing access denied pls any one give me right way to solve it ** -(void)SaveColumnConnection { NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURLURLWithString:@”http://xxxyyyzzzz.php”]]; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:oneRowColumn,@”oneRowCols”,memberTid,@”table_title_id”,totalRowStr,@”totRow”,rowandColumn,@”tempColName”,tableOptIdArray ,@”tempOptid”,companyId,@”companyid”,@”savecolumniphone”,@”tag”,nil]; NSLog(@”dict %@”,dict); SBJSON […]