Sign Xamarin iOS service extension with mbuild - ios

Xamarin cross platform app with a notification service extension.
When I build the app in Visual Studio with "Archive app for publishing", then sign manually the iOS project AND the service extension with the ad-hoc profiles (for the example), and upload to AppCenter for distribution, it's installing fine on our test devices.
However, the company process involve TeamCity for building the app automatically at each branch push using a custom script (msbuild)
Was working fine until i added the service extension. Since that, with the same script, the app builds fine but at instal from AppCenter i get "App integrity couldn't be verified".
I suppose there is something wrong with the tricky iOS signing process but can't figure out what.
Do i need to build the service extension separately using msbuild commands, or is it included in the ios project build as they are linked?
All the <CodesignKey> and <CodesignProvision> tags containing the right names in the .csproj files.
The configuration mappings are well configured.
The build script look like this:
msbuild Project.iOS.sln /t:Build
msbuild Project/Project.iOS/Project.iOS.csproj
msbuild /p:Configuration="Ad-Hoc" \
/p:Platform="iPhone" \
/p:IpaPackageDir="%env.PackageDirectory%" \
/t:Build Project.iOS.sln

Related

Flutter build IOS on windows

I'm working on a flutter project and I want to build the IPA of my code using windows. I don't want to test the application in my windows I want just to build the IPA. Is it possible to do it. Any help is highly appreciated.
The only way to generate an IPA from you windows machine is by using a CI/CD service like Codemagic using the steps described in this article:
link your repository (Github, BitBucket , or Gitlab).
from settings > build for platforms > IOS
change the .app file you received to .zip and extract it.
You will find a file called Runner.app, put in a folder and compress it back.
change the extension from .zip to .ipa.
And here's your first IOS build without a Mac device.
You cannot build a flutter iOS app directly from Windows. What you can do is use external tools to do it. One of these tools is Appollo (https://github.com/Appollo-CLI/Appollo). It's a python CLI tool that let you access remote MacOS build machines.
Here is a demo of how to create the IPA on windows : https://www.youtube.com/watch?v=ZX3DAMwlEfM&t=11s
It's pretty easy to use :
First install it
pip install appollo
Then setup your Apple Developer account with Appollo : https://appollo.readthedocs.io/en/master/tutorial/2_configure_app_store_connect.html
Finally you can build the app and retrieve the IPA
appollo build start --build-type ad-hoc
appollo build ipa
And that's it.

How to run XCTest (UI test cases) of iOS mobile application in the azure pipeline?

How to run XCTest (UI test cases) of iOS mobile application in the Azure pipeline?
Tasks added in pipeline:
Install certificate
Install profile
Use Node 13.3.0
pod install
Xcode-> build action as "build-for-testing"
Test with Visual Studio App Center
At this final step "Test with Visual Studio App Center" we get error
Preparing tests... failed.
Error: Unable to find test runner app within /Users/runner/runners/2.164.8/work/1/a/DerivedData/Build/Products/Staging-iphoneos
[error]Error: /usr/local/bin/appcenter failed with return code: 3
How to run XCTest (UI test cases) of iOS mobile application in the azure pipeline?
According to the document Using Azure DevOps for UI Testing, you need make sure the Arguments in the Advanced section of the Xcode task , specify a derived data path, typically using -derivedDataPath DerivedData.
Bsides, You will also need an .ipa file for your application. An you can build the .ipa file in the same Xcode build-for-testing task by checking the Create app package option, or in a separate Xcode build step or in a Bash script step.
Hope this helps.

How to remove scripts (in a framework) when the ios app is archived?

I'm working on a cocoa pod framework which has a couple of shell scripts in it. After installing the pod, the user should add the following in app's build phase -> run script :
“${PODS_ROOT}/MyPod/MyPod/framework/MyPod.framework/scripts/build.sh”
After this the build works fine and app runs. But archiving creates problems. XCode gives an error saying:
iTunes Store Operation Failed
Invalid Signature. Code object is not signed at all. The file at path [SampleApp.app/Frameworks/MyPod.framework/scripts/build.sh] is not properly signed. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https://developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html
I've two concerns now:
Xcode doens't allow scripts to be a part of archive?
If thats the case, then how do I remove these scripts from archive? Is there a build setting like ${ARCHIVE_DIR} from where I can search for the latest archive and then remove the script. Or, is there some build setting where I can mention what files to ignore while building or archiving?
Also, I've already tried adding these files to 'exclude source file names' to the app's build settings. It didn't work since the script to be executed isn't a part of the app, but part of the framework integrated in app.
Also, my framework is a fat framework generated by using lipo on simulator build and device build. Which means that framework won't be code signed.
Apple does not allow simulation code inside framework when push to store, to overcome this, either ship the framework without simulator arch, or use external script to remove it during app build.
Example script can be found in some framework like Realm, basically you have to add the script file in your framework, and tell user/dev to call this on their build script (it's the strip-frameworks.sh)
This issue is stated in this archiving universal framework bug

Can Xcode (command-line) build an archive without a scheme?

I'm primarily a .NET developer but am trying to compile some applications for iOS using Xcode command-line tools. My goal is to use the command-line to write a script to clone a repository, compile the code, and sign it with my iOS developer certificate.
However, when I clone a Git repository for an iOS/OSX application, it usually only contains a Xcode project file (and sometimes a workspace file). When I try to use 'xcodebuild archive' it requires a scheme to be specified but 'xcodebuild -list' says that none exist.
What is the correct way to automatically generate these schemes from the command-line?

No IPA output for Cordova build in Visual Studio

I'm developing a mobile app with Visual Studio Tools for Apache Cordova CTP 3.1 in VS 2013. I have configured everything according to the MSDN specifications here Install Tools to Build for iOS. I am able to build the app and run the remote simulator (as described here Run Your Apache Cordova App on iOS).
My problem is there is no output from the build back on the Windows machine where I have Visual Studio. More than that, there is no .ipa file created on the Mac either. I can find the build at /Users//remote-builds/builds/ but that's all. I can open the project in XCode for instance, but that's not what I want.
I want the final package file that I can install on test devices and eventually publish to the store. How do I get that?
Also my goal is to setup a TFS build definition so I can get a build each time I commit changes. I need to get that output file to the drop location of my build.
From within VS, you will have to choose "Remote Device" or "Local Device" as your debug target and then "build" to get an IPA back.
Also, refer to TFS build does not copy Cordova project output for instructions on how to setup TFS for CI workflow.

Resources