ionic-native/file breaks 'blank' app in ios simulator

Created on 20 Jul 2017  路  8Comments  路  Source: ionic-team/ionic-native

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request

Current behavior:

The Home page does not display in the ios simulator (with xcode)
Expected behavior:

The Home page should display:

The world is your oyster.
If you get lost, the docs will be your guide.

Steps to reproduce:

Use ionic start to create a new project of type: blank ........ ionic-angular A blank starter project .
'cd' to project directory.
npm i cordova cordova-cli
cordova plugin add cordova-plugin-file
npm install --save @ionic-native/file

Add 'File' to file 'home.ts' resulting in:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { File } from '@ionic-native/file';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController,
    private file: File) {

  }

}

Build with: ionic cordova build ios

With xcode, open the project, and run it.

Related code:
home.html

<ion-header>
  <ion-navbar>
    <ion-title>
      Ionic Blank
    </ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding>
  The world is your oyster.
  <p>
    If you get lost, the <a href="http://ionicframework.com/docs/v2">docs</a> will be your guide.
  </p>
</ion-content>

home.scss:

page-home {

}

Other information:

package.json info:

{
    "name": "tryFile",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/core": "3.12.1",
        "@ionic-native/file": "^4.0.1",
        "@ionic-native/splash-screen": "3.12.1",
        "@ionic-native/status-bar": "3.12.1",
        "@ionic/storage": "2.0.1",
        "cordova": "^7.0.1",
        "cordova-cli": "^1.0.0",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-compat": "^1.1.0",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-file": "^4.3.3",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.2",
        "cordova-plugin-whitelist": "^1.3.1",
        "ionic-angular": "3.5.3",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.12"
    },
    "devDependencies": {
        "@ionic/app-scripts": "2.0.2",
        "@ionic/cli-plugin-cordova": "1.4.1",
        "@ionic/cli-plugin-ionic-angular": "1.3.2",
        "typescript": "2.3.4"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-file": {}
        },
        "platforms": [
            "ios"
        ]
    }
}

ionic info

global packages:

    @ionic/cli-utils : 1.5.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.5.0

local packages:

    @ionic/app-scripts              : 2.0.2
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : ios 4.4.0
    Ionic Framework                 : ionic-angular 3.5.3

System:

    Node       : v7.10.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy : not installed
    ios-sim    : 6.0.0 
    npm        : 5.3.0 

cordova info

Collecting Data...


Node version: v7.10.0

Cordova version: 7.0.1

Config.xml file:

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>MyApp</name>
    <description>An awesome Ionic/Cordova app.</description>
    <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-navigation href="http://ionic.local/*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/[email protected]" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/[email protected]" width="80" />
        <icon height="120" src="resources/ios/icon/[email protected]" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/[email protected]" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/[email protected]" width="120" />
        <icon height="180" src="resources/ios/icon/[email protected]" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/[email protected]" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/[email protected]" width="152" />
        <icon height="167" src="resources/ios/icon/[email protected]" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/[email protected]" width="58" />
        <icon height="87" src="resources/ios/icon/[email protected]" width="87" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
    </platform>
    <engine name="ios" spec="^4.4.0" />
    <plugin name="cordova-plugin-console" spec="^1.0.5" />
    <plugin name="cordova-plugin-device" spec="^1.1.4" />
    <plugin name="cordova-plugin-file" spec="^4.3.3" />
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
    <plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
</widget>
Plugins: 

cordova-plugin-compat,cordova-plugin-console,cordova-plugin-device,cordova-plugin-file,cordova-plugin-splashscreen,cordova-plugin-statusbar,cordova-plugin-whitelist,ionic-plugin-keyboard

iOS platform:

Xcode 8.3.3
Build version 8E3004b



md5-c5554bf0b81de4d2f85382a2c01abb55



objc[47880]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x106f06cc0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x106c7c6f0). One of the two will be used. Which one is undefined.
2017-07-20 00:24:58.646 MyApp[47880:1040773] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/mg/Library/Developer/CoreSimulator/Devices/463B8F61-145D-4D82-A23A-4A498CCC592F/data/Containers/Data/Application/44AA1B5F-6C0E-4BF7-8435-3F6D91C77C38/Library/Cookies/io.ionic.starter.binarycookies
2017-07-20 00:24:59.195 MyApp[47880:1040773] Apache Cordova native platform version 4.4.0 is starting.
2017-07-20 00:24:59.197 MyApp[47880:1040773] Multi-tasking -> Device: YES, App: YES
2017-07-20 00:25:00.094 MyApp[47880:1040773] Using UIWebView
2017-07-20 00:25:00.096 MyApp[47880:1040773] [CDVTimer][handleopenurl] 0.149012ms
2017-07-20 00:25:00.106 MyApp[47880:1040773] [CDVTimer][intentandnavigationfilter] 9.402037ms
2017-07-20 00:25:00.107 MyApp[47880:1040773] [CDVTimer][gesturehandler] 0.114977ms
2017-07-20 00:25:00.206 MyApp[47880:1040773] [CDVTimer][splashscreen] 99.602044ms
2017-07-20 00:25:00.331 MyApp[47880:1040773] [CDVTimer][statusbar] 123.863995ms
2017-07-20 00:25:00.332 MyApp[47880:1040773] [CDVTimer][keyboard] 1.358986ms
2017-07-20 00:25:00.388 MyApp[47880:1040773] [CDVTimer][file] 55.258036ms
2017-07-20 00:25:00.388 MyApp[47880:1040773] [CDVTimer][TotalPluginStartup] 292.019010ms
2017-07-20 00:25:11.017 MyApp[47880:1040773] Resetting plugins due to page load.
2017-07-20 00:25:15.206 MyApp[47880:1040773] Finished load of: file:///Users/mg/Library/Developer/CoreSimulator/Devices/463B8F61-145D-4D82-A23A-4A498CCC592F/data/Containers/Bundle/Application/AFB17150-8A58-4140-98FD-96E95E959798/MyApp.app/www/index.html
2017-07-20 00:25:15.458 MyApp[47880:1040773] THREAD WARNING: ['StatusBar'] took '39.206055' ms. Plugin should use a background thread.
2017-07-20 00:25:15.476 MyApp[47880:1040773] Ionic Native: deviceready event fired after 1722 ms
2017-07-20 00:25:15.606 MyApp[47880:1040773] THREAD WARNING: ['StatusBar'] took '129.031006' ms. Plugin should use a background thread.
2017-07-20 00:42:01.010387-0700 MyApp[47880:1040773] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/mg/Library/Developer/CoreSimulator/Devices/463B8F61-145D-4D82-A23A-4A498CCC592F/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-07-20 00:42:01.014650-0700 MyApp[47880:1040773] [MC] Reading from private effective user settings.
needs reply not-an-issue

Most helpful comment

@Sampath-Lokuge @MJGz I'll discuss this with the Ionic team and get back to you.

All 8 comments

I want to turn this into a document change/enhancement request.
In https://ionicframework.com/docs/native/file/, it it stated "2. Add this plugin to your app's module", as a link, under Installation.
Following the linked process removes the failure.
Please be more explicit, in the example, that file app.module.ts should include:

...
import { File } from '@ionic-native/file';
...
providers: [
...
  File,
...
]
...

@FCSz So you're asking that we should add a block on each doc page that shows how to add the provider to your app's NgModule?

@ihadeed Actually this is a very good feature request for the official doc.He is asking to put relevant @NgModule code block on the same page where without redirecting it into a generic method(i.e. Camera).I know this is an open source project and you cannot handle all the things.So I would like to contribute for that if you'll tell me how to do that.But I don't know whether is that possible or not.I mean add a content to the official doc as a none Ionic team member. Hope you'll give a feedback for this.Thanks.

@ihadeed Yes, I recommend adding a "a block on each doc page that shows how to add the provider to your app's NgModule".
It would greatly help developers like me, that are just starting to use ionic. I suspect that the trivial example now given does not help those that are very experienced with ionic-native.
I further recommend that more significant examples be provided. I would be happy to propose some examples. Perhaps @Sampath-Lokuge would help me get them into the documentation.
Furthermore, for the ionic-native/file plugin in particular, I see some opportunities to improve the documentation. I am willing to make some proposals for this, also.

@MJGz Yes, I would like to help to give a support to improve the doc.Please let me know how can I help you?

@Sampath-Lokuge @MJGz I'll discuss this with the Ionic team and get back to you.

@ihadeed OK sure.Great 馃憤

I created a sample app at FCSz/Example-Ionic-Native-File-App that shows the basic ionic-native/file function of listing the contents of the root directories. It also shows the use of this.platform.ready().then(), and using observables to protect data. I tested it on a Nexus 5X, via Visual Studio 2017, on Windows 10. I do not have an iPhone.
@Sampath-Lokuge : Do you suggest any changes?

Was this page helpful?
0 / 5 - 0 ratings