You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Radu Moian-Dusa (JIRA)" <ji...@apache.org> on 2016/08/31 10:41:21 UTC

[jira] [Created] (CB-11794) Hook after_build not working on iOS

Radu Moian-Dusa created CB-11794:
------------------------------------

             Summary: Hook after_build not working on iOS
                 Key: CB-11794
                 URL: https://issues.apache.org/jira/browse/CB-11794
             Project: Apache Cordova
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
          Components: iOS
         Environment: OS X 10.11.6

Tools:
node: v6.4.0
npm: 3.10.6
cordova: 6.3.1
ionic: 2.0.0
grunt: grunt-cli v1.2.0
grunt v1.0.1
bower: 1.7.9

Installed platforms:
  ios 4.2.1

My app is written using ionic 1 and angularjs 1
            Reporter: Radu Moian-Dusa


I discovered the bug, by following this scenario:

clean ionic project;
open terminal at project root;

1. rm -rf plugins/ (remove the plugins folder)

2. cordova add platform ios

3. cordova build ios

4. ls -l platforms/ios/<PROJECT_NAME>/Images.xcassets/AppIcon.appiconset/ and ls -l platforms/ios/<PROJECT_NAME>/Images.xcassets/LaunchImage.launchimage/

5. in both folders found above, we find the Contents.json file that tells xcode which icon/splash screen goes to wich resolution

6. cordova platform rm ios

7. cordova platform add ios (add the platform again, but the plugins are installed from plugins/ folder found in the root of the project)

8. cordova build ios

9. ls -l platforms/ios/<PROJECT_NAME>/Images.xcassets/AppIcon.appiconset/ and ls -l platforms/ios/<PROJECT_NAME>/Images.xcassets/LaunchImage.launchimage/

10. in both folders found above is missing the Contents.json file, so, after we open <PROJECT_NAME>.xcodeproj file in xcode, all the icons and launch screens are unassigned, so the app starts on the iOS device at a wrong resolution. (example: run app on iPhone 5C and the app starts at iPhone 4 resolution with black bars on top and bottom).

I think this might be a cordova Bug but I am not sure.

As a workaround, I copied the Contents.json files to another location in my project and: 

1. added an after_build hook to copy these file into platforms/ios/<PROJECT_NAME>/Images.xcassets/AppIcon.appiconset/ and platforms/ios/<PROJECT_NAME>/Images.xcassets/LaunchImage.launchimage/ paths.

2. cordova platform rm ios

3. cordova platform add ios

4. cordova build ios

5. this should be the place where the after_build hook should run.

If you run cordova build ios again the hook works.

I have noticed that the first time you run cordova build ios the message "** BUILD SUCCEEDED **" does not appear, sometimes only after the third time of running cordova build ios this message appears. From what I can tell only when the message ** BUILD SUCCEEDED ** appears the after_build hook is run. 

This issue can be reproduced with the after_compile hook as well.

What I have done in order to achieve this "workaround" is: I have made a before_compile hook which copies the Contents.json file where it should be copied and it works.

I hope that I described the problem well. If there are any questions you can ask me later





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org