I'm experimenting. Could you help me? I have a problem.

I'm experimenting with an app I've made in Xcode. I have a button, that displays the social networks (on click) only if the user drops an image into the image view. Otherwise the button does nothing. I would like to display the alert saying "You have to drop an image into the app." or something like that. Could you help me?
Tiny part of the code is down there...
- (IBAction)shareToService:(id)sender {
    NSMutableArray *shareItems = [NSMutableArray arrayWithObject:[self.textView string]];
    NSImage *image = [self.imageView image];
    if (image) {
        [shareItems addObject:image];
        NSSharingServicePicker *sharingPicker = [[NSSharingServicePicker alloc] initWithItems:shareItems];
        sharingPicker.delegate = self;
        [sharingPicker showRelativeToRect:[self.shareButton bounds] ofView:self.shareButton preferredEdge:NSMaxYEdge];
    else{nil;};

Sorry, I misread that completely. Replace that else clause with something like this:
  NSAlert * alert = [[NSAlert alloc] init];
  [alert setMessageText: NSLocalizedString(@"Image Required", NULL)];
  [alert setAlertStyle: NSInformationalAlertStyle];
  [alert setInformativeText: NSLocalizedString(@"You have to drop an image into the app", NULL)];
  [alert runModal];

Similar Messages

Maybe you are looking for

  • How can I make my CP modules more stable and reliable?

    We've recently rolled out a major compliance training module to our whole company. It was quite a large project about 13mb when published, including audio. It was delivered via the latest version of Saba. Some users had no problems with it - it ran a

  • Central Performance History from satellite systems

    Hi, I'm investigating Central Performance History at the moment but am having problems getting the statistics from the satellite systems from Solution Manager. I have our Solution Manager system setup as the CCMS CEN. I monitor about 10 SAP instances

  • How to get sequence name in run time.

    hi I have several sub sequence called in the main sequence in TestStand. Those sub sequences have different sequence names, which i wanted to display by string indicator on the Labview Operator Interface. Is there a simple way to show the current cal

  • The Power Direktor 12 can not found a camera from USB

    I have load Power Direktor 12 Install Win 7 64 bit oll ok but when i go over vidio Grubber in USB the Programm found nothing ! A other Programm from my found this . What can i doit with Power Direktor  fre USB ?

  • "Uh-oh, something went wrong! Error Code: 503"

    I keep getting this error code and I've tried everything to fix it but nothing works. Also it only happens on my computer nobody elses