Software Archive
Read-only legacy content
17061 Discussions

Cordova External Build Problem iOS After Creating Package

Namık_Zafer_E_
New Contributor I
642 Views

I am MAC user. My Intel XDK version is 3900. I created Cordova mobile application. I opened the "Build" section. I created a package of my application.

I entered the package by terminal and run below commands one by one. (Cordova CLI)

cordova platform add ios

cordova prepare

cordova build ios

After all, i gave the package access both write and read to my user. I opened the platform file from the package. I run the .xcodeproj file and opened it into Xcode. When i run the application from Xcode, The application seems to work but "all my applicaiton functionalities" did not work. I also tried to export ipa from Xcode then they did not work too. They worked when i simulated from Intel XDK and also your old build system which export ipa file.

I also tried Phone Gap Build. I got Adobe ID and uploaded my application to Phone Gap. I encountered the same problem. The application only works with Intel XDK build which will be deprecated.

Could you give me old build commands which you use when building an application? or Which steps do i miss when building my application? 

Best Regards

0 Kudos
1 Solution
Namık_Zafer_E_
New Contributor I
642 Views

Thanks for your replies.

It is very interesting. I had "Content-Security-Policy" meta data in all my html files but i did not write "data:* gap://* tel:*". My application works as i expected when i build from old Intel XDK Cloud Based Build but it does not work when i build from Cordova CLI and Phone Gap.

Anyway

I found my solution. In html files, "Content-Security-Policy" meta data is very important. (data:* gap://* tel:*)

To build an iOS application from outside of Intel XDK by using Cordova CLI, follow below steps

  • Do not forget to add the "Content-Security-Policy" meta data to every html files. You can use this one: <meta http-equiv="Content-Security-Policy" content="default-src * data:* gap://* tel:*; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* https://* 'unsafe-inline' 'unsafe-eval'" />
  • Download your application package from Intel XDK Build Tab "Create Package".
  • Open terminal
  • In terminal, go to the application file which is downloaded from Intel XDK 
  • run this command: sudo cordova platform add ios --save
  • exit the terminal
  • give permissions (write and read) to the application file and files inside it
  • enter the application file, go to ../platforms/ios/
  • open .xcodeproj file from Xcode
  • Add certificate and provision profile files to the application from Xcode
  • Archieve .ipa file from Xcode

View solution in original post

0 Kudos
5 Replies
PaulF_IntelCorp
Employee
642 Views

The build commands we are using are inside the exported config.xml file that was generated by the package export. We use Cordova CLI to build in our cloud-based build system. I believe our build system is using Xcode 7, you may be using Xcode 8, which may create some differences, but I don't believe those differences will be significant.

When you execute the "cordova build ios" command it will generate an IPA, you should not be opening Xcode or using Xcode directly to generate that IPA file. Can you build the sample "hello-cordova" app and generate an IPA with that project using CLI or PhoneGap Build? I recommend you use that sample as a test case, to be sure you have the process down.

0 Kudos
Namık_Zafer_E_
New Contributor I
642 Views

Thanks for response but i explain what i ask.

While Intel XDK Cloud Building, I wanted your commands like "cordova build ios" not a config.xml. I will also examine your log file after old IntelXDK build.

About ipa, after "cordova build ios" command, it does not create ipa because of certificate and provision profile file. I add these files from Xcode easily then i archive the application as ipa from the Xcode

Of course, i tried "hello-cordova" application. It is so simple and basic. My application contains a lot of details and more complex functionalities inside of  "hello-cordova".

Xcode 7 and Xcode 8 may create important differences like IntelXDK platform versions or Swift 2 versus Swift 3. Maybe some functionalities deprecated. I will explore it

When i build with CLI and PhoneGap, all processes are finished successfully. I opened the application and it worked but all functionalities did not work. Only my application works as i want and expect with your old IntelXDK Cloud Build so I do not understand which you do out of basic CLI terminal commands.

1) Could you share all terminal commands sequentially?

2) Do you use the file which is exported from IntelXDK "create package" field in your old cloud base build?

3) Does it make any difference to create the application before IntelXDK 3900 version to use "create package" build properties?

4) Do you make automatically change any basic configuration or code wrongness before build in old Cloud Base IntelXDK build?

Best Regards

0 Kudos
PaulF_IntelCorp
Employee
642 Views

Namık Zafer E. wrote:

About ipa, after "cordova build ios" command, it does not create ipa because of certificate and provision profile file. I add these files from Xcode easily then i archive the application as ipa from the Xcode

This describes the simplest approach for managing your iOS certs and creating a signed IPA with Cordova CLI > http://stackoverflow.com/a/35197647/2914328 < which references this Cordova CLI doc > http://cordova.apache.org/docs/en/6.x/guide/platforms/ios/index.html#using-buildjson <

 

Namık Zafer E. wrote:

When i build with CLI and PhoneGap, all processes are finished successfully. I opened the application and it worked but all functionalities did not work. Only my application works as i want and expect with your old IntelXDK Cloud Build so I do not understand which you do out of basic CLI terminal commands.

1) Could you share all terminal commands sequentially?

2) Do you use the file which is exported from IntelXDK "create package" field in your old cloud base build?

3) Does it make any difference to create the application before IntelXDK 3900 version to use "create package" build properties?

4) Do you make automatically change any basic configuration or code wrongness before build in old Cloud Base IntelXDK build?

1) There are a collection of scripts that essentially do the following:

  • create a new empty blank Cordova project
  • copy the contents of the www folder provided by the XDK to the new project's www folder
  • add the desired Cordova platform (in your case, iOS) to the new project
  • add the plugins that were provided by the XDK to the new project
  • move the icons and splash screen images that were provided by the XDK into the new project
  • perform a cordova build
  • sign the packages that were created
  • deliver for download

I recommend you use the build.json approach along with the --device and --release options, as described in the SO post I provided above.

2) The cloud system builds a config.xml file that is similar to what the export tool provides, but it is not identical, because our cloud-based build system does not need to be compatible with PhoneGap Build and, more importantly, it sees all plugins as local private plugins, because the contents of your project's plugins folder is sent to the cloud in a separate package (just a ZIP of the plugins folder in your project folder). Likewise, the icons and splash screens are sent in a separate package (as a ZIP of the package-assets folder). And, your sources are sent in a separate package, which is a ZIP of the www folder in your project. The XDK does not modify any of those three packages before sending them.

3) I don't completely understand this question. I think you are asking if there is any difference between building with 3900 or an older version of the XDK (for example, 3759). There is no difference, there is only one cloud-based build system. The same builder is used regardless of which version of the XDK you are using.

4) Again, I don't completely understand your question. I think you are asking if we automatically correct bad configuration options or code syntax problems in the cloud. The cloud-based system does not modify any config files or code before it attempts a build. It will report errors that result from bad config files. The XDK attempts to identify bad config options before you can perform a build, but it is not able to find all config problems. Bad code is hard to detect, it may show up in the detailed build log which is a copy of the standard Cordova CLI build log. In general, the best way to find potential code problems is to use one of the many code linting tools out there (several can be installed in the Brackets editor that is in the XDK).

0 Kudos
Namık_Zafer_E_
New Contributor I
643 Views

Thanks for your replies.

It is very interesting. I had "Content-Security-Policy" meta data in all my html files but i did not write "data:* gap://* tel:*". My application works as i expected when i build from old Intel XDK Cloud Based Build but it does not work when i build from Cordova CLI and Phone Gap.

Anyway

I found my solution. In html files, "Content-Security-Policy" meta data is very important. (data:* gap://* tel:*)

To build an iOS application from outside of Intel XDK by using Cordova CLI, follow below steps

  • Do not forget to add the "Content-Security-Policy" meta data to every html files. You can use this one: <meta http-equiv="Content-Security-Policy" content="default-src * data:* gap://* tel:*; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* https://* 'unsafe-inline' 'unsafe-eval'" />
  • Download your application package from Intel XDK Build Tab "Create Package".
  • Open terminal
  • In terminal, go to the application file which is downloaded from Intel XDK 
  • run this command: sudo cordova platform add ios --save
  • exit the terminal
  • give permissions (write and read) to the application file and files inside it
  • enter the application file, go to ../platforms/ios/
  • open .xcodeproj file from Xcode
  • Add certificate and provision profile files to the application from Xcode
  • Archieve .ipa file from Xcode
0 Kudos
PaulF_IntelCorp
Employee
642 Views

Namik -- thank you for that very clear set of instructions and useful hints! I will be incorporating your feedback into the export documentation.

0 Kudos
Reply