How to build an IPA/ZIP for app store?

WinterCloudWinterCloud GBMember ✭✭✭

I got developer account from apple, I have set up one distribution profile in Connect.

I'm trying to build an IPA or ZIP file from VS2015 for app store release. However, I'm keep getting following errors.

NO iOS code signing key matches provisioning profile
No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from...

I'm not sure how to set up VS project settings.

For iOS Application section,
what's identifier? the app id? The distribution profile I got from apple shows this 'com-company-appname (com.company.appname)'
So which one is it? I tried a few options, but all failed.

For iOS Bundle Signing,
Identity and Provisioning profile, I can keep both as automatic. However, if I change one, I can't change another one, the other one has to stay as automatic.

Of course, none of the ways I tried above worked. Frustrating...

I tried to follow this guide, however, it's a very rough guide and it's not clear what to do for different situations/issues.

Please point me an guide, video or blog, anything.

Thanks in advance.

Best Answers

Answers

  • SebastianKruseSebastianKruse USMember ✭✭✭
    edited March 2017

    Did you add your Apple certificates to XCode? You need to setup the process correctly. Did you use the correct Build configuration? For a AppStore publish you should use AppStore + iPhone (not Simulator!) and Build the project. After that you need to upload the IPA-File with the application loader (I think it is easier to build the app directly in the Xamarin Studio or Visual Studio for Mac on the Mac itself. So you can use the publish directly.

  • WinterCloudWinterCloud GBMember ✭✭✭

    @SebastianKruse said:
    Did you add your Apple certificates to XCode? You need to setup the process correctly. Did you use the correct Build configuration? For a AppStore publish you should use AppStore + iPhone (not Simulator!) and Build the project. After that you need to upload the IPA-File with the application loader (I think it is easier to build the app directly in the Xamarin Studio or Visual Studio for Mac on the Mac itself. So you can use the publish directly.

    I'm not sure what's the correct way. I can't find any guide showing how to deal with issues.

    In this picture, I only have one profile under distribution. Is this correct?

    I have tried Ad-Hoc, AppStore builds, both using iphone(not Simulator). However, both failed.

    I can't get build to work currently.

  • SebastianKruseSebastianKruse USMember ✭✭✭

    My Mac is at home so I cannot verfiy this yet. I can give you a answer in a few hours (~6 hours from now). I'am not sure if this is correct. If it is you should be able to choose the correct certificate in Xamarin Studio / Visual Studio in the build settings. It is important that the identity matches 100% (com.what.so.ever). Also I would recommand not using wild cards if you plan to use notification or watchKit in the future.

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    Have you worked through the App Store Distribution guide? There are instructions there for creating a signing certificate, which is what you appear to be missing.

  • SebastianKruseSebastianKruse USMember ✭✭✭

    So just take a look at my Xcode configuration. The buttons for "iOS Development" and "iOS Distribution" are no longer visible in my Xcode. Did you setup the process in the apple developer network?

  • WinterCloudWinterCloud GBMember ✭✭✭

    @SebastianKruse said:
    So just take a look at my Xcode configuration. The buttons for "iOS Development" and "iOS Distribution" are no longer visible in my Xcode. Did you setup the process in the apple developer network?

    Have been on this issue over the entire weekend. I followed all guides I can find. I believe I'm doing things correct now. However, I don't believe the this system is working. I'm currently looking for if there is an alternative way to do this? Work around or something?

    What I've done:

    I have completely reinstalled xcode, and now the profile is recognized by VS, but I got that xcode issue everyone's talking about. Profile can't finish downloading.
    https://forums.developer.apple.com/thread/63621

    Can't find solution, can't find work around. It's just so frustrating why this iOS thing is so flimsy.

    VS still can recognize the profile, however, now when I build, I got this error:

    Failed to resolve "System.Reflection.Emit.ILGenerator" reference from "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

    After days on this, I still can't get a build.

  • SebastianKruseSebastianKruse USMember ✭✭✭
    edited March 2017

    @WinterCloud The "cannot download" problem is often because of permissions. When I run into this issue I do the following (read to the end first):

    1. Remove old certificates with the terminal from ~/Library/MobileDevice/Provisioning Profiles
    2. Re-Create all certificates in the Apple Developer Website (just renew any certificate and profile)
    3. Reboot the machine
    4. Try again to install - in 9/10 cases this works for me

    Don't know what Apple did, this problem is only since XCode 8 on older Mac OS systems... As far as VS finds the profiles it will work and is just a problem for XCode, so you can ignore the buttons.

    The other issue seems to be a reference problem. Did you use ReSharper? Because ReSharper can fix such kind of issues. Otherwise try to repair your .NET installation and renew the references in the project. This is a common issue if you change the required .NET version. Otherwise you can try to add the assembly "System.Reflection.Emit.ILGenerator" to your project. https://msdn.microsoft.com/de-de/library/system.reflection.emit.ilgenerator.aspx

    Sorry for my bad english, it is not my primary language (and I'm bad in my primary language as well ^^)

  • WinterCloudWinterCloud GBMember ✭✭✭
    edited March 2017

    @SebastianKruse said:
    @WinterCloud The "cannot download" problem is often because of permissions. When I run into this issue I do the following (read to the end first):

    1. Remove old certificates with the terminal from ~/Library/MobileDevice/Provisioning Profiles
    2. Re-Create all certificates in the Apple Developer Website (just renew any certificate and profile)
    3. Reboot the machine
    4. Try again to install - in 9/10 cases this works for me

    Don't know what Apple did, this problem is only since XCode 8 on older Mac OS systems... As far as VS finds the profiles it will work and is just a problem for XCode, so you can ignore the buttons.

    The other issue seems to be a reference problem. Did you use ReSharper? Because ReSharper can fix such kind of issues. Otherwise try to repair your .NET installation and renew the references in the project. This is a common issue if you change the required .NET version. Otherwise you can try to add the assembly "System.Reflection.Emit.ILGenerator" to your project. https://msdn.microsoft.com/de-de/library/system.reflection.emit.ilgenerator.aspx

    Sorry for my bad english, it is not my primary language (and I'm bad in my primary language as well ^^)

    Thanks for the reply.

    I have tried that on Mac, I have recreated my profile at least 3 times. Delete, redownload. Download is always working, as I can see the file created in that folder, it just the UI can't recognize that.

    Anyway.

    The Xamarin project created with default .NET version 4.5? I've never changed this.

    I do use resharper, however, the error doesn't lead to anywhere, not any code file, only in error log window, so I can't use resharper function to recognize that.

    update:
    I found the "System.Reflection.Emit.ILGenerator" assembly on Nuget, I'll give this another try tonight with Mac, will update if success or not.

    Thanks a lot.

  • WinterCloudWinterCloud GBMember ✭✭✭

    @SebastianKruse said:
    @WinterCloud The "cannot download" problem is often because of permissions. When I run into this issue I do the following (read to the end first):

    1. Remove old certificates with the terminal from ~/Library/MobileDevice/Provisioning Profiles
    2. Re-Create all certificates in the Apple Developer Website (just renew any certificate and profile)
    3. Reboot the machine
    4. Try again to install - in 9/10 cases this works for me

    Don't know what Apple did, this problem is only since XCode 8 on older Mac OS systems... As far as VS finds the profiles it will work and is just a problem for XCode, so you can ignore the buttons.

    The other issue seems to be a reference problem. Did you use ReSharper? Because ReSharper can fix such kind of issues. Otherwise try to repair your .NET installation and renew the references in the project. This is a common issue if you change the required .NET version. Otherwise you can try to add the assembly "System.Reflection.Emit.ILGenerator" to your project. https://msdn.microsoft.com/de-de/library/system.reflection.emit.ilgenerator.aspx

    Sorry for my bad english, it is not my primary language (and I'm bad in my primary language as well ^^)

    Just an update. Another day/night wasted on this.

    I got the System.Reflection.Emit.ILGenerator from Nuget, but it didn't add the dll to my iOS project. I have to manually add it in. There are two versions, 1.0 and 1.3. I tried to build with each of them. However, both failed with same error.

    Debug with simulator with no issue at all, but can't even get a release build. This is extremely frustrating.

    I tried a simple Xamarin.Forms app, and it seems build ok. So the provisioning profile should be correct now. I just don't know what's wrong with this System.Reflection.Emit.ILGenerator and where I can get a reference from.

    I'm currently in the process of rebuild my Mac from scratch, reinstall everything including OS. Hopefully some magic happens that System.Reflection.Emit.ILGenerator just appears from no where.

    :'(

  • WinterCloudWinterCloud GBMember ✭✭✭

    @SebastianKruse said:
    System.Reflection.Emit.ILGenerator is part of the library mscorlib and is a part of the .NET Framework. If it is missing, something is wrong with the installation. But from a developer perspective: You should avoid reflection if it is possible. See: https://msdn.microsoft.com/en-us/library/system.reflection.emit.ilgenerator.aspx

    Android project has this mscorlib.dll referenced. However, iOS project, does not allow this dll to be referenced.... why? I don't know. The error msg when I reference this shows something like this: "build process already reference this dll".

  • SebastianKruseSebastianKruse USMember ✭✭✭

    This is exactly how my projects looks. Android makes the reference to mscorlib and iOS don't. But this should not keep your project unbuildable.

  • WinterCloudWinterCloud GBMember ✭✭✭
    Accepted Answer

    @SebastianKruse said:
    System.Reflection.Emit.ILGenerator is part of the library mscorlib and is a part of the .NET Framework. If it is missing, something is wrong with the installation. But from a developer perspective: You should avoid reflection if it is possible. See: https://msdn.microsoft.com/en-us/library/system.reflection.emit.ilgenerator.aspx

    Just an update about the result of this fiasco.

    To avoid reflection, I agree, which in my app, I don't use reflection. But why can't I build the project?

    So, finally, I found Json.Net was the problem, and then after a few search, I found people are saying Json.Net is actually not suitable for mobile mono use. So after removing Json.Net, the project can be build in release mode.

    After that, are waves of pain caused by Apple review team, well, that's the other problems.

    Thanks for your help.

  • WinterCloudWinterCloud GBMember ✭✭✭

    @JGoldberger said:
    iOS (on device) does not allow runtime code generation so the System.Reflection.Emit namespace is not available. See:

    https://developer.xamarin.com/guides/ios/advanced_topics/limitations/#No_Dynamic_Code_Generation

    Thanks for this.

    I would thought if something is not compatible, it shouldn't be able to add into the project at the first place. And probably shouldn't be working for debug as well. Just me.

  • SebastianKruseSebastianKruse USMember ✭✭✭

    Strange. I use Json.Net in many projects, also with the latest version of it. And so far no trouble at all (except the Apple Watch size limit problem).

  • WinterCloudWinterCloud GBMember ✭✭✭

    @SebastianKruse said:
    Strange. I use Json.Net in many projects, also with the latest version of it. And so far no trouble at all (except the Apple Watch size limit problem).

    My iOS project has a reference to Json.Net, and native code side is using it's functions.

    I installed Json.Net from nuget, i'm not sure if there is any difference between versions of it.

Sign In or Register to comment.