Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web pack issues when build in release mode #2716

Closed
sis0k0 opened this issue Apr 13, 2017 · 43 comments
Closed

Web pack issues when build in release mode #2716

sis0k0 opened this issue Apr 13, 2017 · 43 comments

Comments

@sis0k0
Copy link
Contributor

sis0k0 commented Apr 13, 2017

From @patrickpereira on April 12, 2017 4:56

Hi Nativescript,

I keep getting errors trying to upload the .ipa to itunes connect, what are the build.xcconfig settings and the command that should be used, currently I'm having this in build.xcconfig:

CODE_SIGN_IDENTITY = iPhone Distribution

DEVELOPMENT_TEAM = XXXXXXXX
OR
PROVISIONING_PROFILE = XXXXXXXX

I've tried both DEVELOPMENT_TEAM & PROVISIONING_PROFILE

If I'm using DEVELOPMENT_TEAM I get the following error from application loader:

ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle app.nurt.kcal [Payload/Kcal.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."

If I'm using PROVISIONING_PROFILE, I'm unable to build it and get the following error from the CLI:

Check dependencies
Kcal has conflicting provisioning settings. Kcal is automatically signed, but provisioning profile XC iOS: app.nurt.kcal has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor, or switch to manual signing in the project editor.
Code signing is required for product type 'Application' in SDK 'iOS 10.2'
Code signing is required for product type 'Application' in SDK 'iOS 10.2'
Code signing is required for product type 'Application' in SDK 'iOS 10.2'
Code signing is required for product type 'Application' in SDK 'iOS 10.2'

I know the provisioning profile is valid, since I'm able to do the release through xcode if I compile the ipa there. But for some reason that ipa file is almost twice the size of the one created by the CLI.

The command I'm using in the CLI is: npm run build-ios-bundle -- --release --for-device

Furthermore I'm using tns-ios 2.5.

Hope you can help me ( @sis0k0 ) :-)

Copied from original issue: NativeScript/nativescript-dev-webpack#115

@spike1292
Copy link

We are experiencing the same issue. Now we need to use xcode to release. This means we need a manual step in our build process. This is very inconvenient for us.

@patrickpereira
Copy link

@dtopuzov Any hints as to what is wrong?

@dtopuzov
Copy link
Contributor

Fixed in web pack plugin with this PR: NativeScript/nativescript-dev-webpack#116

We will release new version later today or tomorrow.

@patrickpereira
Copy link

Amazing!!!

@dtopuzov dtopuzov added this to the 3.0.0 milestone Apr 20, 2017
@dtopuzov dtopuzov changed the title Release mode errors Web pack issues when build in release mode Apr 20, 2017
@dtopuzov
Copy link
Contributor

dtopuzov commented Apr 20, 2017

Ups sorry, it looks I was wrong and my previous post was for another issue.

@patrickpereira
Copy link

Yeah - I can see as I'm still getting the same error... But thanks for letting me know, a moment right there I thought my computer was just being weird :-)

@PanayotCankov
Copy link
Contributor

This PR is supposed to address this issue: #2705 There is some more work to be done though.

@patrickpereira
Copy link

Thanks for letting me know @PanayotCankov! Is there a temporary fix that I can apply to get it working, as I'm just about to submit to itunes connect?

@sis0k0
Copy link
Contributor Author

sis0k0 commented Apr 20, 2017

Hi @patrickpereira,

As a workaround you can do the following:
First, prepare the project for iOS using tns prepare ios.
Then, bundle the project with webpack with webpack --config=webpack.ios.js --progress (note: if you don't have webpack installed globally, you should add this to your package.json scripts or run webpack from node_modules/.bin/webpack).
When the project is bundled and prepared in the platforms/ios folder, you can open it and release it through xcode.

We'll add a way to perform the first two steps with ns-bundle and then release the app through xcode later.

sis0k0 added a commit to NativeScript/nativescript-dev-webpack that referenced this issue Apr 20, 2017
If you don't pass `--start-app` or `--build-app` to ns-bundle, the
project will be only prepared and bundled now.
This can be used with the following command:
`npm run ns-bundle --android/ios`

Related to NativeScript/nativescript-cli#2716
sis0k0 added a commit to NativeScript/nativescript-dev-webpack that referenced this issue Apr 20, 2017
If you don't pass `--start-app` or `--build-app` to ns-bundle, the
project will be only prepared and bundled now.
This can be used with the following command:
`npm run ns-bundle --android/ios`

Related to NativeScript/nativescript-cli#2716
@dtopuzov dtopuzov modified the milestones: 3.1.0, 3.0.0 Apr 27, 2017
@dtopuzov dtopuzov added the bug label May 1, 2017
@dtopuzov
Copy link
Contributor

dtopuzov commented May 4, 2017

@patrickpereira #2705 is merged in master and available in nativescript@next.

Can you please try:

npm un -g nativescript
npm cache clean
npm i -g nativescript@next

@dlucidone
Copy link

@sis0k0 I followed the instruction you gave in the previous comments now to upload it i have to juss use the project workspace thats it.?

@sis0k0
Copy link
Contributor Author

sis0k0 commented May 8, 2017

@dlucidone,

Yes, you can publish it through xcode now. Also now you can use the following command to just prepare and bundle the project (without building/starting it):

npm run ns-bundle --ios/--android

@dlucidone
Copy link

@sis0k0 Earlier i tried

npm run build-ios-bundle -- --release --for-device --copy-to /Users/Dlucidone/Desktop/yourappname_1-0-2.ipa --teamId DL***** --provision 32b**525-8*5d-46*9-a*da-c49****3**7e

i got my release ipa ready but i'm having issues with uploading it through Application loader
Should I use `tns publish ios -- ipa to upload my app to app store?

@pkoleva
Copy link
Contributor

pkoleva commented May 25, 2017

Hey @dlucidone @patrickpereira @spike1292

I've managed to start my app by setting CODE_SIGN_IDENTITY and PROVISIONING_PROFILE using the latest @next of the CLI. Could you try and see if it will work for you as well?

Thanks!

@dlucidone
Copy link

dlucidone commented May 26, 2017

@pkoleva I dont want to update my CLI moreover the itunes is not taking my webpacked release ipa. I have to use the platform workspace folder for the release result in app is slow at start time. Can you tell me way i can fix my webpack release issue cause its annoying and the docs are outdated with the release. Each time new release come with new bugs and later need to update CLI.(Tired of trying everything)

@jeffswitzer
Copy link

I'm having a similar issues trying to publish to iTunes connect.

When either using the Application Loader or running
tns publish ios --ipa /myapp/platforms/ios/build/device/myapp.ipa
I get the following error:

ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle org.nativescript.naturesnotebookmobile [Payload/myapp.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."

Here's my processes:

First off I did this to make sure I'm up to date

npm un -g nativescript
npm cache clean
npm i -g nativescript@next

my build.xcconfig looks like so

CODE_SIGN_IDENTITY = iPhone Distribution;
PROVISIONING_PROFILE = iPhone Distribution;
DEVELOPMENT_TEAM = **hiding this**;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;

I can build the ipa file using:
tns build ios --release --for-device
towards the end of the log I do see so I'm thinking it's picking the right cert (it has type iOS Distribution):

Signing Identity:     "iPhone Distribution: **hiding this** (**hiding this**)"
Provisioning Profile: "iPhone Distribution"
                      (**hiding this**)

When I look in Keychain Access, I can see what looks to be the matching certificate and it has a private key attached. I had downloaded this cert from https://developer.apple.com/account/ios/certificate/?teamId=**hiding** and stuck it under login in Keychain Access.

When I open the project inXcode and go to preferences I can see the team and cert listed with no complaints.

In Xcode I currently have "Automatically manage signing" unchecked and have manually selected the iPhone Distribution provisioning profile under both Signing (debug) and Signing (release).

Any ideas as to why I'm getting the error?

@pkoleva
Copy link
Contributor

pkoleva commented May 29, 2017

Hi, @jeffswitzer,

Could you try to set PROVISIONING_PROFILE to the profile id. Also have a look at the "Submission automation" part of this article -> http://docs.nativescript.org/publishing/publishing-ios-apps#submission-automation.
Hope this helps :)

@abhayastudios
Copy link

abhayastudios commented May 29, 2017

@pkoleva I am having the same issue (I think) as @jeffswitzer:

I am trying to upload a webpack release bundle the app store. I am able to successfully build the bundle through: npm run build-ios-bundle -- --release --for-device.

My build.xcconfig contains (same as with Xcode signing settings):

//DEVELOPMENT_TEAM
CODE_SIGN_IDENTITY = iPhone Distribution
PROVISIONING_PROFILE_SPECIFIER = <TEAM ID>/<company name> Distribution

(from what I am reading is that with Xcode 8, PROVISIONING_PROFILE is deprecated)

The build process the informs me:

Signing Identity:     "iPhone Distribution: <company name> (<TEAM ID>)"
Provisioning Profile: "Panaya Distribution"
                      (<distribution profile UUID>)

However, when uploading through application loader I get a similar error as above:

ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle com.panaya.testcenter [Payload/<appname>.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."

When I inspect the IPA I can see that the /Payload/testapp.app/embedded.mobileprovision indeed contains references to the development certificates and provisioning profiles instead of the distribution. I tried just now with today's nativescript@next build.

If I use Xcode to create an archive and upload that one it works just fine (but then it won’t be webpacked).

Seems like there is some kind of bug here.

@abhayastudios
Copy link

abhayastudios commented May 30, 2017

@jeffswitzer as far as I can tell tns publish ios runs a new non-webpacked build resulting in a 21mb IPA for my app (as opposed to 14mb with a webpack build), so I think that is what you uploaded to the app store.

From what I understand if you run npm run build-ios-bundle -- --release --for-device and then archive through xcode, it will archive your webpacked build.

@jeffswitzer
Copy link

jeffswitzer commented May 30, 2017

Actually even if I just target the built ipa like tns publish ios --ipa ~/myNativeScriptApp/platforms/ios/build/device/myApp.ipa I still get

1 package(s) were not uploaded because they had problems:
        /var/folders/j7/ccr72dlx47v9k3b3cqn6nbq00000gn/T/itms-117430-25793-1pi4a95.f84asv2t9/mybundle.itmsp - Error Messages:
                ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle org.nativescript.myApp [Payload/myApp.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."

So when I target the ipa built from tns build ios --release --for-device I get the signing error, but if I just run tns publish ios I don't get the error, but the build disappears from iTunes connect shortly after it is in the processing state. I guess my issues doesn't even require a webpacked build to fail.

@abhayastudios
Copy link

@jeffswitzer I can confirm that by running npm run build-ios-bundle -- --release --for-device and then archive and upload through Xcode, you can successfully publish to the app store (at least the build I just uploaded works in Test Flight) and results in a significantly smaller download that the non-webpack version.

@PanayotCankov
Copy link
Contributor

PanayotCankov commented May 31, 2017

@abhayastudios manually resigning is futile. There are a lot of extra details, first you will have to remove the development mobileprovision, add the distribution mobileprovision. Then code sign the app executable as well as binaries of cocoa touch frameworks you may have used in the Frameworks folder. Zip back the ipa.

tns publish ios won't work with web pack indeed, you have to use the npm scripts. After this commit:
NativeScript/nativescript-dev-webpack@8e7a1b3
is released you should be able to use npm run publish-app along with npm run-app and npm build-app.

For now use npm run build-ios-bundle -- --release --for-device and then open the Xcode workspace or project, from the IDE archive, and from the archive you can sign for distribution and upload to the store.

@dlucidone
Copy link

dlucidone commented May 31, 2017

@PanayotCankov if i'll use this command
npm run build-ios-bundle -- --release --for-device
then i'll get ipa for my app how can i use it to sign with xcode as opening the project in xcode will not use the webpacked generated ipa can you elaborate steps to perform webpacking app along with signing it.

@PanayotCankov
Copy link
Contributor

@dlucidone After you run npm run build-ios-bundle -- --release --for-device the Xcode project in the platforms/ios should have the web pack assets, you should be able to open that project in Xcode. From the device selection (near the play / stop buttons) select Generic iOS Device. Then in the top menu select Product > Archive. This will open the Organiser window and focus the archive, in the righthand section there you have the options to "Upload to App Store", "Validate..." and "Export...". Consider using the "Upload to App Store...", it will ask you for Team ID and will sign and upload the app to the App Store.

@dlucidone
Copy link

dlucidone commented Jun 1, 2017

@PanayotCankov i have a doubt if i'll use this command
npm run build-ios-bundle -- --release --for-device my ipa will be generated right? Correct me if i'm wrong .
And if I will open project again in xcode and again archive it will not use the ipa build already generated i think it will generate new one because i have seen huge performance lag in launch screen compared to webpacked ipa and generating ipa by archiving it through xcode.

If you can do steps below i suggest you can measure difference -

1- Create a webpacked release ipa and then test it through iTunes on device the performance is much better.
2- Webpack and use platform folder and then again archive it then use that ipa i find lot of performance difference in both the scenarios.
Thanks

@dbenninger
Copy link

I have the same or a similar issue as @abhayastudios and @jeffswitzer

Signing with ad-hoc distribution profiles does not work properly. It seems that the ipa is signed with a developer identity. This blocks us from upgrading to NS3 and xcode 8.3. We have to stick with NS 2.5.3 and xcode 8.2 for now...

@dlucidone
Copy link

@dbenninger I followed instructions by @PanayotCankov and seems like i'm able to deliver my app to test flight with webpacking.

@dbenninger
Copy link

@dlucidone thanks, thats good to know, but it must also work on our ci server.

@dbenninger
Copy link

dbenninger commented Jun 12, 2017

Okay, I have found a workaround. I had to add
<key>method</key> <string>ad-hoc</string>
to my Info.plist and signing with ad-hoc distribution profiles seems to work now.

@dtopuzov
Copy link
Contributor

@dbenninger Thanks for posting the workaround.

@jeffswitzer
Copy link

@dbenninger thank you! I was going absolutely mad. In my case I needed to use <key>method</key> <string>app-store</string>
This link has the available options.

Note that even when not using webpack it seems I need to have this in my Info.plist. The steps I take are:

  1. tns build ios --release --for-device
  2. tns publish ios --ipa /path_to_my_ipa

Without <key>method</key> <string>app-store</string> the publish step gives the ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle org.nativescript.myApp [Payload/myApp.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."

@vchimev vchimev self-assigned this Jun 19, 2017
@tjvantoll
Copy link
Contributor

tjvantoll commented Jul 24, 2017

@dbenninger THANK YOU! 🌮

@PanayotCankov @sis0k0 @pkoleva Why is it necessary to add <key>method</key><string>app-store</string> to your Info.plist to perform release builds that iTunes Connect accepts?

We either need to workaround this on the CLI, or we need to get this on the documentation asap. I can help with the docs, but I need to know what we want to recommend here, and why this works the way it does.

Could the CLI handle this for us when with the --release flag maybe?

@PanayotCankov
Copy link
Contributor

Because this is broken:

"-exportOptionsPlist", platformData.configurationFilePath

We add the info.plist as plist for the export when building,
while the export accepts completely different format.
It is like a tool needs some data such as method = app-store in XML and we sticked the AndroidManifest.xml in it just in case.

@PanayotCankov
Copy link
Contributor

I have tried to elaborate on the problem here: #3020

@alereisan
Copy link

I have the same problem, even after trying to publish with 'ad-hoc' or 'app-store' suggestions from above..

@cerireyhan
Copy link

@alereisan Did you manage to solve this issue? I tried 'ad-hoc- and 'app-store' like you but I still have it.

@alereisan
Copy link

@cerireyhan I solved it by making a new provisioning profile and certificate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests