Okay, so I'm writing an application in Xcode (version 3) for Mac OS X and I'm having trouble with my IBactions. I write them, and connect them to my buttons, but for some reason, they are never called when I click the button. I have double checked and triple checked the connections in Interface builder, but no luck. If you can't help with this, then maybe somebody knows how to manually connect actions to buttons in code? I have found Can you hard code IBActions and IBOutlets, rather than drag them manually in Interface Builder?, but that is for iphone, and what it suggests didn't seem to be in Mac OS X cocoa, only cocoa touch (Not sure though). If anybody could help, I would greatly appreciate it.
UPDATE: I can confirm that this problem is only in one project. New projects work fine.
Have you tried uninstalling your app from simulator/device and do a fresh build and run? I had the same problem and that did the trick for me.
I was running into this same problem and hoped this post had the answer. After some more testing, it seems to do with the signature of the IBAction.
This signature didn't work:
-(IBAction)myAction;
This signature did work:
-(IBAction)myAction:(id)sender;
Adding in the sender parameter seems to do the trick.
Related
I have a share-extension bounded with my app. I have all the required app-ids and provisioning-profiles related to the extension, for both development and distribution. When I run the extension in the simulator, it works perfectly fine. On device (i.e. iPhone 6), for example, when choose my app's share extension within Safari, Safari freezes and nothing opens. I cannot even debug it, not because that I don't know how to do it but because it runs and immediately stops running afterwards on Xcode.
I think that something might be wrong with the provisioning-profiles or app-ids or it might be a bug or a 'missing functionality prior to distribution' caused by Apple.
I would very much appreciate it if someone has any solution to or explanation about it.
EDIT:
I changed the background-color of the extension's view on storyboard to see if it does not work at all. It does open, but SLComposeServiceViewController did not show up. Thus, the problem must be caused by it.
If there is anyone still having this issue, please check your Share Extension deployment info and ensure your target OS is lower than your phone's OS
I finally solved my problem. It was not a provisioning-profile nor an app-id issue. I had written
override func viewDidAppear(animated: Bool) {}
method in the SLComposeServiceViewController class. It turns out that the only culprit was this method. I removed that and the share extension worked perfectly.
I have not been able to get my NSPopover to detach to a window in my own projects, so to simplify I tried the Apple sample.
I downloaded a fresh copy of the Apple sample project: http://developer.apple.com/library/mac/samplecode/Popover/Introduction/Intro.html
It behaves the same, which is to say I can't drag the window to detach it either.
The project seems to provide all the correct windows and controllers and implements the detachableWindowForPopover: delegate method. However the method is never called.
Does anyone know the secret to detachable NSPopovers?
Found the answer while typing the question…
Mac OS X 10.10 Yosemite has a new delegate method:
(BOOL)popoverShouldDetach:(NSPopover *)popover
The default behavior on Yosemite is NO (should not detach). So delegates must implement this method in order for windows to be detachable. The sample project does not implement this method, so when compiled on Yosemite it will not detach (and also produces several deprecation warnings -- maybe I should have taken that hint that it needs an update).
Adding:
- (BOOL)popoverShouldDetach:(NSPopover *)popover {
return YES;
}
To MyWindowController.m fixes the problem.
I am a bit new to the iPhone, but I have done some work on the Mac before. In my App there is a text field. And if I´m editing this text field, the App crashes after a few types, and there is an an EXC_BAD_ACCESS sign in main. I have added an other textfield, right in the standart view. It crashes, too, although I have not done anything with it. I have no idea, and I killed every release, so that nothing is overreleased, bit it does not help. Has anyone an idea? thanks
I found the answer. It´s a bug in iPhone Simulator. I had to turn off autocorrecting. Then it worked.
Are you working with XCode 4.1? This is a problem related to that version, I just downloaded the Xcode 4.1.1 from the App Store and the problem went away completely.
Regards
I have searched quite a lot for an answer to this problem. If I have a general application, HelloWorld, and create an interface and then go to test it, then click on the Home button, not even the default grey/white icon is there like it's supposed to be. Anyone have any ideas why? I've even tried specifying a custom icon in the Info.plist file, but still nothing...
I've got the latest version of Xcode and the SDK as well. (3.25 - 4.2)
I solved it. Apparently, in order for it to put the icon there, I have to run it from within XCode, and not Interface Builder.
I have a relatively confusing problem: I created several empty Xcode projects and ran the iPhone and iPad emulators just to see what happens and everything is fine, empty, but fine. However, then I decided to actually add some content but when I double click my .xib file nothing happens. The Xcode loses focus, but nothing opens. The Interface Builder simply does not open.
Do I need to start it separately somehow or do I need to download and install it separately or something else altogether?
I had the same problem when i first installed xcode.
What solved it for me was manually starting the Interface Builder once (via spotlight).
After that it worked again by double clicking on the xib file in xcode....
The most common cause of this in my experience is failure to reboot after installing or upgrading Xcode. Xcode gives you the impression that you don't need a reboot, but in practice you do. Have you done this yet?
Try to search for interface builder in Mac OS search bar on the top right of the screen, open it, click on open existing file. Open any xib file once, then it will be automatically detectedd by xCode.