bradmartin / nativescript-snackbar

:lollipop: :chocolate_bar: NativeScript plugin for Material Design SnackBar
Apache License 2.0
73 stars 12 forks source link

Bug IOS Simultator: NSBundle.mainBundle is not a function #14

Closed marcbuils closed 7 years ago

marcbuils commented 7 years ago

Hi,

The plugin doesn't work for me on iOS Simulator.

Use case If I call the function snackbar.simple() on an iOS simulator with a iOS version < 10, I have the following error :

CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:2838:32: EXCEPTION: Uncaught (in promise): TypeError: NSBundle.mainBundle is not a function. (In 'NSBundle.mainBundle()', 'NSBundle.mainBundle' is an instance of NSBundle)
CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:2843:36: ORIGINAL STACKTRACE:
CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:2844:36: resolvePromise@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:416:40
        file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:393:27
        file:///app/tns_modules/nativescript-snackbar/snackbar.js:30:23
        ZoneAwarePromise@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:465:37
        simple@file:///app/tns_modules/nativescript-snackbar/snackbar.js:10:27
        info@file:///app/services/notification.service.js:24:30
        file:///app/services/list.service.js:54:43
        __tryOrSetError@file:///app/tns_modules/rxjs/Subscriber.js:232:20
        next@file:///app/tns_modules/rxjs/Subscriber.js:174:42
        _next@file:///app/tns_modules/rxjs/Subscriber.js:125:30
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        _next@file:///app/tns_modules/rxjs/operator/do.js:82:28
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:133:34
        _next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        _next@file:///app/tns_modules/rxjs/Subscriber.js:125:30
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        _next@file:///app/tns_modules/rxjs/operator/map.js:83:30
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        onLoad@file:///app/tns_modules/@angular/http/bundles/http.umd.js:1022:46
        file:///app/tns_modules/xhr/xhr.js:148:26
        forEach@[native code]
        emitEvent@file:///app/tns_modules/xhr/xhr.js:147:25
        _setReadyState@file:///app/tns_modules/xhr/xhr.js:223:31
        _loadResponse@file:///app/tns_modules/xhr/xhr.js:90:28
        file:///app/tns_modules/xhr/xhr.js:67:40
        invoke@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:190:33
        onInvoke@file:///app/tns_modules/@angular/core/bundles/core.umd.js:5976:47
        invoke@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:189:42
        run@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:83:49
        file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:60
        invokeTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:42
        onInvokeTask@file:///app/tns_modules/@angular/core/bundles/core.umd.js:5967:51
        invokeTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:222:54
        runTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:123:57
        drainMicroTaskQueue@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:355:42
        promiseReactionJob@[native code]
        UIApplicationMain@[native code]
        start@file:///app/tns_modules/application/application.js:251:30
        bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:67:26
        bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:55:26
        anonymous@file:///app/main.js:46:57
        evaluate@[native code]
        moduleEvaluation@[native code]
        [native code]
        promiseReactionJob@[native code]
Dec  7 00:06:44 MacBook-Pro-de-Marc CestDansLeCoin[87432]: CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:342:26: Unhandled Promise rejection: NSBundle.mainBundle is not a function. (In 'NSBundle.mainBundle()', 'NSBundle.mainBundle' is an instance of NSBundle) ; Zone: angular ; Task: Promise.then ; Value: TypeError: NSBundle.mainBundle is not a function. (In 'NSBundle.mainBundle()', 'NSBundle.mainBundle' is an instance of NSBundle) _getActionText@file:///app/tns_modules/nativescript-snackbar/snackbar.js:91:111
        file:///app/tns_modules/nativescript-snackbar/snackbar.js:13:140
        ZoneAwarePromise@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:465:37
        simple@file:///app/tns_modules/nativescript-snackbar/snackbar.js:10:27
        info@file:///app/services/notification.service.js:24:30
        file:///app/services/list.service.js:54:43
        __tryOrSetError@file:///app/tns_modules/rxjs/Subscriber.js:232:20
        next@file:///app/tns_modules/rxjs/Subscriber.js:174:42
        _next@file:///app/tns_modules/rxjs/Subscriber.js:125:30
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        _next@file:///app/tns_modules/rxjs/operator/do.js:82:28
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:133:34
        _next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        _next@file:///app/tns_modules/rxjs/Subscriber.js:125:30
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        _next@file:///app/tns_modules/rxjs/operator/map.js:83:30
        next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
        onLoad@file:///app/tns_modules/@angular/http/bundles/http.umd.js:1022:46
        file:///app/tns_modules/xhr/xhr.js:148:26
        forEach@[native code]
        emitEvent@file:///app/tns_modules/xhr/xhr.js:147:25
        _setReadyState@file:///app/tns_modules/xhr/xhr.js:223:31
        _loadResponse@file:///app/tns_modules/xhr/xhr.js:90:28
        file:///app/tns_modules/xhr/xhr.js:67:40
        invoke@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:190:33
        onInvoke@file:///app/tns_modules/@angular/core/bundles/core.umd.js:5976:47
        invoke@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:189:42
        run@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:83:49
        file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:60
        invokeTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:42
        onInvokeTask@file:///app/tns_modules/@angular/core/bundles/core.umd.js:5967:51
        invokeTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:222:54
        runTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:123:57
        drainMicroTaskQueue@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:355:42
        promiseReactionJob@[native code]
        UIApplicationMain@[native code]
        start@file:///app/tns_modules/application/application.js:251:30
        bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:67:26
        bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:55:26
        anonymous@file:///app/main.js:46:57
        evaluate@[native code]
        moduleEvaluation@[native code]
        [native code]
        promiseReactionJob@[native code]
Dec  7 00:06:44 MacBook-Pro-de-Marc CestDansLeCoin[87432]: CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:344:22: Error: Uncaught (in promise): TypeError: NSBundle.mainBundle is not a function. (In 'NSBundle.mainBundle()', 'NSBundle.mainBundle' is an instance of NSBundle)

Technical informations : native-snackbar: 1.1.5 xcode : 8.1 nativescript : 2.4.1 iOS Simulator: iOS 9.2 -> iPhone 6