Search This Blog

Sunday, 23 March 2014

Notification issue -iOS

Hello Friends,

Seems  like Apple is not serious with there job ... ;) , i found another bug in iOS 7 , what happened was i triggered a local notification from my app only when my app is in background , local notification has Sound file which is supposed to be played when notification is delivered to user. And WHOA, when user taps on local notification and app becomes active, local notification sound kept on playing whereas it was supposed to be stopped. Then with little R&D , i found that this issue is with iOS 7 only and its working fine for previous versions.

       So enough talks ... phewww is the function to fix this issue

//Fix Local Notification sound issue for iOS 7
- (void)fixLocalNotificationforiOS7{
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
        [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 1];
        [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];

Happy programming... :)

CHAO...Signing out...

Tuesday, 11 March 2014

UITextView issue -iOS

Hello Friends,

                So here is another thing coming in iOS7 which may annoy you some day today or iOS7 , if you guys noted or not your UITextView clips last line out of view. Try this thing tap on return until you reach end of UITextView bounds now again tap return and start typing ....voila where is the text !!!

             Actually it gets clipped , i am not sure if it is a bug or apple did this intentionally. But, the bottom line is  " It's Annoying" . Yesterday i wasted 2 hours to solve this issue :P

           And here is the code which may handle this thing at some extent.

NOTE: This code will clip the last line on tapping return , but as soon as user starts typing characters the line becomes visible :)

STEP 1: I assume you are using UITextViewDelegate in your view controller.

STEP 2: Simply over ride this below delegate function in your view controller.

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
   [textView scrollRangeToVisible:range];
    return YES;

I am simply trying to autoscroll the textview to make the range visible. I think its the easiest way to cope with it , until apple sort out this thing :)

Happy Programming!