applicationwillfinishaunching handler not working applescript xcode - xcode

My on applicationWillFinishLaunching_(aNotification) handler isn't working. It works with my "xib" IB, but it doesn't work with my ".storyboard" IB. Where in the IB should I look? I have searched quite a bit looking for anything that says "applicationWillFinnishLaunching" but no luck. The handler only works if my main storyboard is an ".xib" file but when I make it a ".storyboard" it doesn't work.

Create a new project and check the connection you see in the image below.
Then try to find if the same connection is broken in your project and recreate it.

Related

DocumentPicker Extension immediately stopped on clicking on the icon

I have created the document picker extension(Both File provide and document picker , with the default implementations) and when i try to open the extension using the DocumentPickerViewController, its immediately closing the DocumentPickerViewController by showing the below issue
plugin com.apple.UIKit.fileprovider.default invalidated.
I have setup the basic app groups and iCloud entitlement as well, Which are all fine. Even from the documentViewController the default iCloud is working perfectly fine.
Actually i am testing the extension using the same container application.
If somebody can provide some insight about this behavior, it would be a great help !!
Thanks,
Vishnu
I got the issue, actually the value of NSExtensionFileProviderDocumentGroup key was put incorrectly put on the info.plist of the file provider extension by XCode by the time of adding the App group.
Then I compared the files with the NBox sample from Apple and finally figured it out.
So sometimes beware of XCode automatic actions, make a cross check so to save to time.

Could not connect action to NSViewController

I have a stupid problem with Xcode. Sometimes - and I don't know why, because I always follow the same procedure - if I create an IBAction from the nib file of my NSViewController to the .h-file of this NSViewController, I get the error "Could not connect the action buttonCancelClicked: to target of class NSViewController".
It's crazy, because the File's Owner is set to the .h-file and even if I click the button, the IBAction is called. Only Xcode throws this error.
Is this a bug of Xcode? Can I do something to remove this error?
An NSViewController serves to manage NSViews. Disconnect the button first. Declare the action in (maybe another) class, save, and read the header in IB again and connect it in IB the button. That's how I do it and never had a problem.
Another reason that will generate this message is when the class identifier is not pointing to the correct Project. I had copied a class from one project to another.
My initial class identifier looked as follows:
This generated the console messages as shown in the original question.
I set the class then as follows:
This solved the problem.

setValue:forUndefinedKey:]:

FinalViewWithSending *newView = [[FinalViewWithSending alloc]initWithNibName:#"FinalViewWithSending" bundle:nil];
newView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:newView animated:YES]; //it crashes here with a thread 1 error, SIGABRT error..
It says:
"Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<FinalViewWithSending 0x1bef70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key loginButton.'"
There is no variable called loginButton so Im not sure why i am getting an error...
Thank you
You are getting the error because there is no property called loginButton. Check your .xib file. There is almost certainly a bad link to a FinalViewWithSending object (likely File's Owner) that specifies loginButton even though it doesn't exist in the class code.
Phillip Mills is correct.
The answer here, for anyone searching, is to edit the storyboard and remove any link to the undefined key specified. You have to edit the storyboard file in an external editor: Right click on the storyboard listing in the hierarchy and then click on "show in finder" or what have you. Open in a text editor, remove said links by searching, save and return to Xcode. No more issue.
This happens when you remove something from the view controller improperly.
Agreeing here - Phillip Mills is correct.
Someone mentioned opening the storyboard up in a text editor - this isn't necessary.
Just click on the storyboard, go to the Connections Inspector. If you've got a problematic outlet, you'll see an exclamation marker next to the outlet. Delete it.
Since this is the first search result for this error, I decided to write an answer for rookies like me.
You are going to get this error if you have Ctrl dragged connections from Buttons which generates code in your ViewController and then you delete just the code without removing the connection.
I got this error because I had accidently added a few buttons as Outlets, when I wanted to add them as Actions. I deleted the code that got generated but the bad connections were still there.
To find and remove them, View->Utilities->Show Connections Inspector
Then click through the different buttons you have and click the x to remove the bad connections.
If you have any localizations, search for bad links in all the storyboards (expand storyboard to find localized storyboards).
This was my situation. I was looking for bad links in one storyboard and they were in the localized one.
You can try the way I used to fix my setValue:forUndefinedKey:]: problem.
I had the same problem:
I had previously made a connection using storyboards from a textfield to a header file. I later decided I wanted to rename my object's connection, unfortunately, I didn't break the connection properly. If this problem was the same as mine, a connection existed to a button previously, and the code in the header was deleted, but the connection was not.
Check the object connections in the view you are segueing to.
You can use associated objects to avoid subclassing. As for the setValue:forKey: and setValue:forUndefinedKey:, take a look in the header file (NSKeyValueCoding.h) for details.
According to your description,
Find newView in your interface builder and right click it,
you will see something like loginButton which is abnormal.
Today I was working and I presented this same error, I used the response of Phillip Mills was correct and I had some labels in one ViewController.xib that were not being assigned links, i have five bad links, once assigned links, everything works perfectly, thanks answer of Phillip Mills.
Go to the connection inspector of your xib of FinalViewWithSending view controller & remove the reference of login button. After that it will run. Try It... :)
Probably, you earlier created the LoginButton, Cmd+Shift+F and find the "LoginButton" and remove the Referencing Outlet and Re-build.
This reply might be late relative to the time the question was asked but I just had this issue and I tried all solution posted here but none worked.
Here is my solution which could help anyone in the future.
Firstly the problem, :I used a custom cell class and made my connections, everything worked fine with my app then, I renamed my custom cell class ran my app but crashed with setValue:forUndefinedKey:] error.
My solution : Clicked .xib file, selected Identity inspector and typed the new named class in Custom Class -> Class tag.
App error resolved.

Webcore NSBeep()! when copy from uiwebview

I'm developing an epub reader with monocle (https://github.com/joseph/Monocle) which is launched in a uiwebview. My problem is that when I try to copy some text, like what we would do in any other uiwebview, it doesn't seems to do anything... well, I get Webcore NSBeep()! in output view.
any idea or approach?
Webcore NSBeep()! is a error notification, because when you try to copy text from UIWebview the text is not copied into your clipboard and the error notified using a beep (IMHO which is not wise way of notifying errorr by any platform, it would have been any visual indication)
And please note : NSBeep() is part of the ApplicationKit framework which doesn't exist on the iPhone.
I had the same strange issue, irritatingly enough everything worked for quite some time. Then with some changes, this error happened. Reverting the code did not help. After a whole day searching and thinking, I still don't know what caused this, but I know that it wasn't my code!
My theory is that either my git repository was somehow messed up or it was because I edited my project with a beta version of the IDE+SDK. Either way, you should probably look into recreating your webview in InterfaceBuilder. Or recreate your project (or at least partially to confirm that it might be a bug in the project itself). I think/hope that the error will go away then.

file's owner of xib is not what i expect

i'm using xcode4.
i have a xib window (perhaps copyed by another one, i forgot because i have made it some times ago) named: chooseCharacter.xib
i have the chooseCharacter.h and .m as view controller (i thought)
i have added
-(IBAction)doneButtonClick;
on the chooseCharacter.h but i've not seen it in interface builder actions...
i have added this on HighScoreViewController.h and it now shows up...
however, if i put it on HighScoreViewController.h i must put the implementation in chooseCharacter.m or i get
-[ChooseCharacter doneButtonClick]: unrecognized selector sent to instance 0xcc0d9b0'
seems that the window is binded with a file's owner that is HighScoreViewController.h but search implementation in ChooseCharacter.m!!!
how can i bind the xib to the right file?
thanks
found it.
selecting in interface builder, file's owner and clicking in identity inspector under class was HighScoreViewController, changed to chooseCharacter now it works

Resources