Tag: objective c

ios10: viewDidLoad frame width/height not initialized correctly

Since upgrading to XCode8 GM and ios10, all of my views created via Interface Builder are not being initialized correctly until much much later than expected. This means in viewDidLoad, cellForRowAtIndexPath, viewWillAppear, etc, the frame size is set to {1000,1000} for every view. At some point they seem to correct, but its far too late. […]

const vs static NSStrings in Objective-C

These lines are both in the implementation file above the @implementation declaration. NSString * const aVar = @”aVarStringValue”; static NSString *aVar = @”aVarStringValue”; As far as I understand, the second static is allocated once only within the lifetime of the application and this fact contributes to performance. But does this mean it is essentially a […]

How to dump data stored in objective-c object (NSArray or NSDictionary)

Forgive me for a potentially silly question here, but in other programming languages (scripting ones like PHP or Perl) it is often easy to dump everything contained within a variable. For instance, in PHP there are the var_dump() or print_r() functions. Perl has the Data::Dumper CPAN class, etc etc. Is there something like this for […]

Printing NSData using NSLog

How can I print the contents of an NSData object using NSLog: -(void) post:(NSString*) msg to:(NSString*) link{ NSString *myRequestString = [NSString stringWithFormat:@”message=%@”, msg]; NSData *myRequestData = [NSData dataWithBytes: [myRequestString UTF8String] length: [myRequestString length]]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: link]]; [request setValue:@”application/x-www-form-urlencoded” forHTTPHeaderField:@”content-type”]; [request setHTTPMethod: @”POST”]; [request setHTTPBody: myRequestData]; NSData *returnData = [NSURLConnection […]

Removing all CALayer's sublayers

I have trouble with deleting all of layer’s sublayers. I currently do this manually, but that brings unnecessary clutter. I found many topics about this in google, but no answer. I tried to do something like this: for(CALayer *layer in rootLayer.sublayers) { [layer removeFromSublayer]; } but it didn’t work. Also, i tried to clone rootLayer.sublayers […]

Select row After UIPickerView is loaded

I have an iphone database app that loads a UIPickerView with data from a table. I want to set the selected row to a particular row from the data in another table. for example: Lets say I have a UIPickerView that is loaded with X number of names of the iPhone users friends (the number […]

Add Custom Controls to MoviePlayer

I am trying to figure out how to add a custom control to the iPhone MoviePlayer. For an example of what I am trying to do see the following image. alt text http://img.ioscake.com/iphone/ml_v2.3.html I am trying to add something like the controls on the right and left of the basic movie controls. I had done […]

Do OCUnit and OCMock work on the iPhone SDK?

I simply could not make it work, and I am wondering if I am wasting my time, or if I am simply stupid! Sorry I don’t have the exact error I have right now. But I just want to know if it work or not!

ARC __bridge modifiers demystified

I was asked recently by one of my friends about the new bridge modifiers that became active under ARC. He asked me if I knew which ones to use in specific times and what the difference between the different __bridge modifiers were. He asked me,”so how do they work, when do I use them, how […]

Error : The service is invalid

I am having some problem in installing my app on the iphone as I am constantly getting the following error message The service is invalid Please check your setup and try again (0XE8000022) It was running perfectly well till yesterday but since yesterday I am having this problem.