Recent Comments

There are a total of 559 comments on this site.
Below are the most recent 30 of them, newest at the top.

ansh on Xcode crashes every time you open it – and how to fix it

Tuesday, 21st November 2017

worked for me :)

Laura Weaver on Xcode crashes every time you open it – and how to fix it

Monday, 13th November 2017

For those who are still struggling: Add a possible restart to your steps. After trying the above multiple times, adding the restart after made the difference.

HappyMan on How to share things with a UIActivityViewController

Wednesday, 8th November 2017

Thank you for the article, let me complete the sharing feature quickly :D

Jay Versluis on How to change the header in an NSTableView

Sunday, 5th November 2017

Great, thanks for sharing.

Vitauct on How to change the header in an NSTableView

Friday, 3rd November 2017

At my end it worked with 'setNeedsDisplay' instead of 'setNeedsLayout' which makes more sense to me.

Jay Versluis on How to share things with a UIActivityViewController

Saturday, 9th September 2017

Hi Tux, I did some investigating, and the demo code runs fine as is on my iOS 9 device, sharing an image to the camera roll without a hitch. On iOS 10 however, I got a crash with the following explanation:

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
After fixing that, it shared the image as it should. I've explained how to add this key here: http://pinkstone.co.uk/what-is-the-nsphotolibraryusagedescription-key/. I've also updated my Demo Project to include this key now, it should work fine with iOS 10 now.

TuxLR on How to share things with a UIActivityViewController

Saturday, 9th September 2017

Hy, Using Xcode 8.3.3 and iPad (10.3.3), the image sharing does not work at all (there is just no image .. even not a blank or corrupted image ..) If you have any idea ? Anyway, thank you for your code ! Tux

Jay Versluis on How to use Swift classes in Objective-C

Tuesday, 15th August 2017

:-)

Chris Pa on How to use Swift classes in Objective-C

Sunday, 13th August 2017

Thanks! Best tutorial for this topic out there <3

Jay Versluis on Tip: How to download apps again after changing the region of your Apple ID (for free)

Thursday, 3rd August 2017

Indeed, In-App purchases that you've previously bought in another country will also work.

Jared on Tip: How to download apps again after changing the region of your Apple ID (for free)

Tuesday, 1st August 2017

Hi, any chance you tried to redownload any in-app purchases?

Jay Versluis on How to create infinite loops in Objective-C and C

Tuesday, 18th July 2017

Very good point Jayesh! You can exit loops at any time using the break statement. For example:

for ( ; ; ) {
    if (i == 47) {
        break;
    }
}
This works for finite loops as well of course.

Jayesh lathiya on How to create infinite loops in Objective-C and C

Tuesday, 18th July 2017

How to exit from infinite loop?

Jay Versluis on How to use Swift classes in Objective-C

Friday, 28th April 2017

Hi Param, you can change your Avatar picture anytime by heading over to gravatar.com and associating the email with which you leave comments.

Param on How to use Swift classes in Objective-C

Wednesday, 26th April 2017

didn't liked the picture next to comment

Param on How to use Swift classes in Objective-C

Wednesday, 26th April 2017

Great tutorial :)

Jay Versluis on How to fix "Couldn't communicate with a helper application" in Xcode 7

Saturday, 22nd April 2017

Excellent, thank you for sharing!

Adolfo Frias on How to fix "Couldn't communicate with a helper application" in Xcode 7

Tuesday, 18th April 2017

Worked for the latest update to Xcode 8.3.1! Thanks

Nive on How to fix "Couldn't communicate with a helper application" in Xcode 7

Monday, 6th March 2017

Thanks works for me!!

Stev on How to fix "Couldn't communicate with a helper application" in Xcode 7

Friday, 3rd March 2017

Jeesh, thanks. Never deny anything to an Apple app...

sagarsneh on How to fix "Couldn't communicate with a helper application" in Xcode 7

Sunday, 12th February 2017

Thanks!

Jay Versluis on How to use UIPasteboard to share data with iOS

Sunday, 5th February 2017

Excellent, thanks for sharing!

Paul on How to use UIPasteboard to share data with iOS

Sunday, 5th February 2017

Ah, I got it to work! I was using NSData but then found I did not need to do that as can use .image directly :-) THANKS ;-)

  //var myData = NSData()
        
  //self.textDocumentProxy.insertText(String(myData.length))
        
 // myData = NSData(data: UIImagePNGRepresentation(UIImage(named: "mymoji")!)!)
        
//UIPasteboard.general.setData(myData as Data, forPasteboardType:"com.mycom.mymoji")
        
UIPasteboard.general.image = UIImage(named: "mymoji")
        
self.textDocumentProxy.insertText(String(myData.length))
        
if (UIPasteboard.general.hasImages) {
            
    self.textDocumentProxy.insertText("Image in pasteboard");
            
 }
 else {
            
  self.textDocumentProxy.insertText("no image");
 }

Jay Versluis on How to use UIPasteboard to share data with iOS

Saturday, 4th February 2017

I would imagine UIPasteboard doesn't mind custom keyboards. How are you setting the image? Can you retrieve it without checking hasImages?

Paul on How to use UIPasteboard to share data with iOS

Saturday, 4th February 2017

Should this work on custom keyboards? I cannot get an image into general pasteboard, hasimages always returns false?

Jay Versluis on How to load different Storyboards for different versions of iOS in Xcode 5

Sunday, 29th January 2017

Glad you got it working :-)

John on How to load different Storyboards for different versions of iOS in Xcode 5

Saturday, 28th January 2017

So using your method, I edited to show the Start Controller to allow the user to show the options, if they do not set them, at all... just a simple else if added... code below for reference...

UIStoryboard *storyboard = nil;
        NSUserDefaults *defaultimperial = [NSUserDefaults standardUserDefaults];
        NSUserDefaults *defaultmetric = [NSUserDefaults standardUserDefaults];
        
        if ([defaultimperial boolForKey:@"unitSwitchImperial"])
        {
            // load imperial storyboard
            storyboard = [self grabStoryboardImperial];
        }
        else if ([defaultmetric boolForKey:@"unitSwitchMetric"])
        {
            // load metric storyboard
            storyboard = [self grabStoryboardMetric];
        }
         else
        {
            // load start storyboard
            storyboard = [self grabStoryboardStart];
        }
        // show the storyboard
        self.window.rootViewController = [storyboard instantiateInitialViewController];
        [self.window makeKeyAndVisible];
Then added the extra storyboard like this...
- (UIStoryboard*)grabStoryboardMetric {
    
    return [UIStoryboard storyboardWithName:@"iPhoneMetric" bundle:nil];
}

- (UIStoryboard*)grabStoryboardImperial {
    
    return [UIStoryboard storyboardWithName:@"iPhoneImperial" bundle:nil];
}

- (UIStoryboard*)grabStoryboardStart {
    
    return [UIStoryboard storyboardWithName:@"start" bundle:nil];
}
Again, thanks for all your help!

John on How to load different Storyboards for different versions of iOS in Xcode 5

Saturday, 28th January 2017

Your method is much more elegant than mine... Thanks for all your effort... it works!

John on How to load different Storyboards for different versions of iOS in Xcode 5

Saturday, 28th January 2017

If anyone is interested... I solved this using the following code...

if([defaultimperial boolForKey:@"unitSwitchImperial"])
        {
            /* Executes when the boolean expression is true */
            UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhoneImperial" bundle:[NSBundle mainBundle]];
            UIViewController *vc =[storyboard instantiateInitialViewController];
            
            // Set root view controller and make windows visible
            self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
            self.window.rootViewController = vc;
            [self.window makeKeyAndVisible];
            NSLog(@"Imperial Storyboard");
        }
        
        else if([defaultmetric boolForKey:@"unitSwitchMetric"])
        {
            /* Executes when the boolean expression is true */
            UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhoneMetric" bundle:[NSBundle mainBundle]];
            UIViewController *vc =[storyboard instantiateInitialViewController];
            
            // Set root view controller and make windows visible
            self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
            self.window.rootViewController = vc;
            [self.window makeKeyAndVisible];
            NSLog(@"Metric Storyboard");
        }
        
        else
        
        {
            /* executes when the none of the above condition is true */
            UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"start" bundle:[NSBundle mainBundle]];
            UIViewController *vc =[storyboard instantiateInitialViewController];
            
            // Set root view controller and make windows visible
            self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
            self.window.rootViewController = vc;
            [self.window makeKeyAndVisible];
            NSLog(@"Start Storyboard");
            
        }

Jay Versluis on How to load different Storyboards for different versions of iOS in Xcode 5

Saturday, 28th January 2017

Hi John, your logic is sound and it's definitely possible. Your code is correct too as far as I can see, there's just one small thing when it comes to checking the user defaults. In applicationDidFinishLaunching, you're saying "if the BOOL isn't set, then set it". This overrides the value every time the app starts, even if the user has chosen metric. What you want to do instead, "if the BOOL is set, load the imperial storyboard. And if the BOOL is not set, then load the metric storyboard". In code this could look something like this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UIStoryboard *storyboard = nil;
    NSUserDefaults *defaultimperial = [NSUserDefaults standardUserDefaults];
    
    if ([defaultimperial boolForKey:@"unitSwitchImperial"]) {
        // load imperial storyboard
        storyboard = [self grabStoryboardImperial];
        
    } else {
        // load metric storyboard
        storyboard = [self grabStoryboardMetric];
    }
    
    // show the storyboard
    self.window.rootViewController = [storyboard instantiateInitialViewController];
    [self.window makeKeyAndVisible];
    
    return YES;
}
Here's a quick demo project: https://github.com/versluis/Pick-a-Storyboard/ Hope this helps!