question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Xcode 8 issue - JS ERROR TypeError: NSNotificationCenter.defaultCenter is not a function.

See original GitHub issue

Thanks for the very handy module!

I upgraded to Xcode 8 and Nativescript 2.3.0, and I’m using 1.1.2 of this module.

My app is crashing as soon as the module is referenced. I tried installing your demo app with the following in the package.jspn file:

{
    "nativescript": {
        "id": "org.nativescript.localnotifications",
        "tns-android": {
            "version": "2.3.0"
        },
        "tns-ios": {
            "version": "2.3.0"
        }
    },
    "dependencies": {
        "nativescript-local-notifications": "1.1.2",
        "tns-core-modules": "2.3.0"
    },
    "devDependencies": {
        "babel-traverse": "6.8.0",
        "babel-types": "6.8.1",
        "babylon": "6.8.0",
        "filewalker": "0.1.2",
        "lazy": "1.0.11",
        "nativescript-dev-typescript": "^0.3.1",
        "typescript": "^1.8.2"
    }
}

The app builds and then crashes with the following error:

Sep 17 08:30:10 raef LocalNotifications[28139]: file:///app/tns_modules/nativescript-local-notifications/local-notifications.js:4:44: JS ERROR TypeError: NSNotificationCenter.defaultCenter is not a function. (In 'NSNotificationCenter.defaultCenter()', 'NSNotificationCenter.defaultCenter' is an instance of NSNotificationCenter)
Sep 17 08:30:10 raef com.apple.CoreSimulator.SimDevice.A02F4667-157D-4C2F-8665-8DBA15F8995C.launchd_sim[19818] (UIKitApplication:org.nativescript.localnotifications[0x9b6a][28139]): Service exited due to Segmentation fault: 11

This is the same error I am getting in my project.

Any ideas?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
EddyVerbruggencommented, Sep 19, 2016

Thanks for the quick test, published 1.1.3.

1reaction
algcommented, Sep 19, 2016

@EddyVerbruggen worked like charm. Thanks, mate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Send and receive messages through NSNotificationCenter in ...
Just wondering where [NSNotificationCenter defaultCenter] is meant to placed. Is it best to place it in your AppDelegate? – fulvio. Jan 12, 2011 ......
Read more >
NSNotification selector method not… | Apple Developer Forums
I've set up a notification added to a NSButton: Class X. post notification: [[NSNotificationCenter defaultCenter] postNotificationName:@"cbCheckBoxEntred" ...
Read more >
NSDistributedNotificationCenter - Documentation
Specifies that an object no longer wants to receive certain notifications. Overview. Each task has a default distributed notification center that you access ......
Read more >
addObserverForName:object:queue:usingBlock
Adds an entry to the notification center to receive notifications that passed to the provided block.
Read more >
Error: Type 'UIResponder' has no member 'NSNotification'
After updating OS and Xcode I get errors from external librarys. The initial error is: 'keyboardWillShowNotification' has been renamed to 'NSNotification.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found