【问题标题】:Why PhoneGap (cloud) packaged iOS app always shows default splashscreen image in iOS?为什么 PhoneGap(云)打包的 iOS 应用程序总是在 iOS 中显示默认的闪屏图像?
【发布时间】:2014-06-04 14:02:14
【问题描述】:

我在 Sencha Touch 2.3.1-gpl 中创建了一个跨平台应用程序(将打包用于 iOS、Android 和 Windows Phone),并通过 phonegap.com 将其打包用于 iOS( Phonegap 云)。该应用程序和应用程序图标在所有 iOS 设备上都可以正常工作,但是当应用程序启动时,会显示此默认的 Phonegap 启动画面

我在 Phonegap(云)UI 中找不到任何用于为我的应用选择启动画面的选项:

现在我的问题是:

  • 我可以在哪里或如何为我的应用程序定义自定义启动屏幕?

  • 是否必须在 Sencha Touch 应用程序代码中指定启动画面? 是否必须将其添加到 Phonegap(云)UI 中的某处?

这是我的 Sencha Touch app.js 代码,我没有指定任何图标或启动画面,因为根据我的理解,图标和启动画面必须添加到 Phonegap(云)中:

Ext.Loader.setConfig({disableCaching: false});
Ext.application({
    name: 'RedmineApp',
    views: ['Issue', 'ProjectIssues', 'RedmineIssuesNavigator', 'RedmineTabPanel', 'RedmineChart', 'RedmineChartsNavigator', 'UserInputView', 'RedmineIDChart', 'RedminePriorityChart', 'RedmineTrackerChart', 'RedmineStatusChart', 'IssueHistory'],
    models: ['RedmineConfig', 'Issue', 'IssueCategory', 'IssuePriority', 'Project', 'ProjectMembership', 'Tracker', 'User', 'IssueStatus'],
    stores: ['RedmineConfigs', 'Projects', 'IssuePriorities', 'IssueStatuses'],
    controllers: ['Projects', 'Issues', 'ChartsMenu', 'UserInputFields'],
    launch: function() {
        // Destroy the #appLoadingIndicator element
        Ext.fly('appLoadingIndicator').destroy();
        // Initialize the main view
        Ext.Viewport.add(Ext.create('RedmineApp.view.RedmineTabPanel'));
    },
    projectIdentifier: null,
    redmine_url: '',
    redmine_access_key: '',
    loadRedmineConfig: function() {
        var configStore = Ext.getStore('RedmineConfigs');
        configStore.load();
        var redmine_config = configStore.getAt(0);
        if (redmine_config !== undefined) {
            this.redmine_url = redmine_config.get('redmine_url');
            this.redmine_access_key = redmine_config.get('redmine_access_key');
        } else {
            this.redmine_url = 'http://redmine.arkhitech.com';
        }
    },
    saveRedmineConfig: function() {
        var newRecord = new RedmineApp.model.RedmineConfig({
            redmine_url: this.redmine_url,
            redmine_access_key: this.redmine_access_key
        });
        var configStore = Ext.getStore('RedmineConfigs');
        configStore.load();
        configStore.removeAll();
        configStore.add(newRecord);
        configStore.sync();
    },
    setRedmineUrl: function(redmine_url) {
        this.redmine_url = redmine_url.replace(/\/$/, '');
        this.saveRedmineConfig();
    },
    getRedmineUrl: function() {
        if (this.redmine_url === '') {
            this.loadRedmineConfig();
        }
        return this.redmine_url;
    },
    redmine_base_path: '',
    setRedmineBasePath: function(redmine_base_path) {
        this.redmine_base_path = redmine_base_path;
    },
    getRedmineBasePath: function() {
        return this.redmine_base_path;
    },
    setRedmineAccessKey: function(redmine_access_key) {
        this.redmine_access_key = redmine_access_key;
        this.saveRedmineConfig();
    },
    getRedmineAccessKey: function() {
        if (this.redmine_access_key === '') {
            this.loadRedmineConfig();
        }
        return this.redmine_access_key;
    },
    setCurrentProjectIdentifier: function(projectIdentifier) {
        this.projectIdentifier = projectIdentifier;
    },
    getCurrentProjectIdentifier: function() {
        return this.projectIdentifier;
    },
    getCurrentProjectTrackers: function() {
        return this.projectTrackersStore;
    },
    setCurrentProjectTrackers: function(projectTrackersStore) {
        this.projectTrackersStore = projectTrackersStore;
    },
    getCurrentIssuesStore: function() {
        return this.createIssuesStore(this.getCurrentProjectIdentifier());
    },
    getCurrentProjectIssueCategories: function() {
        return this.issueCategoriesStore;
    },
    setCurrentProjectIssueCategories: function(issueCategoriesStore) {
        this.issueCategoriesStore = issueCategoriesStore;
    },
    loadProjectSettings: function(project_id) {
        var Project = Ext.ModelManager.getModel('RedmineApp.model.Project');
        Project.load(project_id, {
            success: function(project) {
                RedmineApp.app.setCurrentProjectTrackers(project.trackersStore);
                RedmineApp.app.setCurrentProjectIssueCategories(project.issueCategoriesStore);
            }
        });
    },
    createIssuesStore: function(projectIdentifier) {
        var newStore = Ext.create('Ext.data.Store', {
            model: 'RedmineApp.model.Issue',
            autoLoad: true,
            proxy: {
                type: 'dynamicrest',
                resourcePath: '/projects/' + projectIdentifier + '/issues',
                format: 'json',
                reader: {
                    rootProperty: 'issues',
                    type: 'json'
                }
            },
            grouper: {
                groupFn: function(record) {
                    return record.get('updated_on');
                },
                sortProperty: 'updated_on',
                    direction: 'DESC'
                }
            });
            return newStore;
        }
    });

【问题讨论】:

    标签: cordova extjs splash-screen sencha-touch-2.3


    【解决方案1】:

    通过在 Sencha Touch App 代码的根目录中添加这个 config.xml 文件来解决它:

     <?xml version="1.0" encoding="UTF-8" ?>
            <widget xmlns   = "http://www.w3.org/ns/widgets"
                xmlns:gap   = "http://phonegap.com/ns/1.0"
                id          = "com.phonegap.example"
                versionCode = "10" 
                version     = "1.0.0" >
    
            <!-- versionCode is optional and Android only -->
    
            <name>Your app name</name>
    
            <description>
                Your app description
            </description>
    
            <author href="http://www.author.com" email="info@email.com">
                Author Name 
            </author>
        <!-- iPhone and iPod touch -->
        <gap:splash src="splash/ios/Default.png" gap:platform="ios" width="320" height="480" />
        <gap:splash src="splash/ios/Default@2x.png" gap:platform="ios" width="640" height="960" />
    
        <!-- iPhone 5 / iPod Touch (5th Generation) -->
        <gap:splash src="splash/ios/Default-568h@2x.png" gap:platform="ios" width="640" height="1136" />
    
        <!-- iPad -->
        <gap:splash src="splash/ios/Default-Portrait.png" gap:platform="ios" width="768" height="1024" />
        <gap:splash src="splash/ios/Default-Landscape.png" gap:platform="ios" width="1024" height="768" />
    
        <!-- Retina iPad -->
        <gap:splash src="splash/ios/Default-Portrait@2x.png" gap:platform="ios" width="1536" height="2048" />
        <gap:splash src="splash/ios/Default-Landscape@2x.png" gap:platform="ios" width="2048" height="1536" />
        </widget>
    

    添加此文件后,Phonegap (Cloud) 开始从此 config.xml 文件中获取名称、描述和启动屏幕,而不是使用其自己的默认值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多