romk1n / MyCordovaShop

Example code for PayPal Mobile SDK Cordova/Phonegap Plugin
MIT License
26 stars 28 forks source link

ios emulation: Cannot read property 'name' of undefined #7

Open motatoes opened 6 years ago

motatoes commented 6 years ago

Hello! I followed the ios specific instructions in the README file:

$ git clone https://github.com/romk1n/MyCordovaShop.git
$ cordova plugin add cordova-plugin-console
$ cordova plugin add com.paypal.cordova.mobilesdk
$ cordova platform add ios
$ cordova platform run ios

In order to run the app in an emulator on a mac I ran npm install ios-sim. After that I previews the list of emulators available with ios-sim listdevicetypes. I then ran the following command to start the app in the emulator:

$ cordova emulate ios --target="iPhone-6s, 11.0" -d --verbose

The result of this command as follows:

EU239:MyCordovaShop user131431$ phonegap emulate ios --target="iPhone-6s, 11.0" -d --verbose
[phonegap] executing 'cordova emulate ios "--target=iPhone-6s, 11.0" -d --verbose ' ...
No scripts found for hook "before_emulate".

No scripts found for hook "before_prepare".

Checking config.xml and package.json for saved platforms that haven't been added to the project

Config.xml and package.json platforms are the same. No pkg.json modification.

Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.

PlatformApi successfully found for platform ios

Checking config.xml for saved plugins that haven't been added to the project

Checking for any plugins added to the project that have not been installed in ios platform

No differences found between plugins added to project and installed in ios platform. Continuing...

Generating platform-specific config.xml from defaults for iOS at /Users/user131431/Desktop/MyCordovaShop/platforms/ios/MyCordovaShop/config.xml

Merging project's config.xml into platform-specific iOS config.xml

Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www

  copy  platforms/ios/platform_www/cordova_plugins.js platforms/ios/www/cordova_plugins.js (updated file)

  copy  platforms/ios/platform_www/js/paypal-mobile-js-helper.js platforms/ios/www/js/paypal-mobile-js-helper.js (updated file)

  copy  platforms/ios/platform_www/plugins/com.paypal.cordova.mobilesdk/www/cdv-plugin-paypal-mobile-sdk.js platforms/ios/www/plugins/com.paypal.cordova.mobilesdk/www/cdv-plugin-paypal-mobile-sdk.js (updated file)

  copy  platforms/ios/platform_www/plugins/cordova-plugin-console/www/console-via-logger.js platforms/ios/www/plugins/cordova-plugin-console/www/console-via-logger.js (updated file)

  copy  platforms/ios/platform_www/plugins/cordova-plugin-console/www/logger.js platforms/ios/www/plugins/cordova-plugin-console/www/logger.js (updated file)

Current launch storyboard undefined

Not changing launch storyboard setting in info plist.

Wrote out iOS Bundle Identifier "com.mycompany.cordova.myshop" and iOS Bundle Version "0.0.1" to /Users/user131431/Desktop/MyCordovaShop/platforms/ios/MyCordovaShop/MyCordovaShop-Info.plist

Need to update build settings because project is using legacy launch images and no storyboard.

Set ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME to LaunchImage because project is using legacy launch images and no storyboard.

iOS Product Name has not changed (still "MyCordovaShop")

Updating icons at platforms/ios/MyCordovaShop/Images.xcassets/AppIcon.appiconset/

Updating splash screens at platforms/ios/MyCordovaShop/Images.xcassets/LaunchImage.launchimage/

Updating launch storyboard images at platforms/ios/MyCordovaShop/Images.xcassets/LaunchStoryboard.imageset/

Updating Storyboard image set contents.json

This app does not have additional resource files defined

Prepared iOS project successfully

No scripts found for hook "after_prepare".

Error: Cannot read property 'name' of undefined

I'm not sure why I'm getting the error of "cannot read '''name' of undefied" but I found that this issue is related to https://github.com/ionic-team/ionic-cli/issues/2487. In particular, this comment which is related to updating cordova v4.5.0 seems to fix this form me. However, I don't see why this shouldn't work in versions less than 4.5.0. Reporting this issue for future reference to save someone else sometime.

romk1n commented 6 years ago

@motatoes at the time when I wrote this plugin iconic was only starting, so I never tested it there. Unfortunately, i don't use neither Cordova (PhoneGap) nor ionic and don't really know what maybe the issue. Also, this sample code is quite old and may not be working with recent versions, checkout the official plugin issues I am sure someone had similar issue. Sorry.

motatoes commented 6 years ago

Hi @romk1n It's actually not an iconic issue. I was just trying to run this repository code on an iOS simulator on mac. I linked to the iconic issue because the reported error there is the same one I received. It's probably a cordova-related problem. Upgrading to Cordova-ios 4.5.0 fixes it for me as stated above, but I'm not sure what causes it in the first place. the plugin is working fine for me after this update. I just thought of leaving this here to anyone who might be experiencing the same problem later.

Feel free to close it as the exact bug isn't clear for now anyways. Thanks!