Nativescript - where is the production provision files coming from (iOS) - nativescript

I'm publishing for iOS and confused as to where the provision files coming from.
I deleted all the files from ~/Library/MobileDevice/Provisioning Profiles
I do a build with:
tns publish ios my-apple-id-email my-password --team-id XXXXX
and it seems to work.
Where is it getting the provisioning files from?
Is NS downloading it automatically.
How does it know when one to use.
Production I guess because I'm using a "publish" command.
What if I have multiple prov. profiles on developer.apple.com
Little bit confused...want to make sure I understand how this works.

#dashman with help of this "tns prepare ios --provision" command you will get provision profile detail of that project.
Detail regarding provisional profile is added in "build.xcconfig" file.

Related

Xamarin.UITest AppCenter Cannot find test-cloud.exe

I have created Xamarin.UITest that can run locally on my desktop. My goal is to execute these test as a part of a post-build script to run UITest after the app has built as mentioned in this article below:
https://tomsoderling.github.io/AppCenter-Automated-UI-tests-on-build/
Below is my script
appcenter test run uitest --app "MY-APP" --devices 168683d9 --app-path $APPCENTER_OUTPUT_DIRECTORY/MyApp.Mobile.Droid.apk --test-series "myapp-mobile-test" --locale "en_US" --build-dir $APPCENTER_SOURCE_DIRECTORY/MyApp.Mobile.UITests/bin/Release --token MY-TOKEN --uitest-tools-dir $APPCENTER_SOURCE_DIRECTORY/packages/Xamarin.UITest.*/tools
When the script above is apart of my appcenter post build script, I get the following error:
Error: Cannot find test-cloud.exe, the path specified by "--uitest-tools-dir" was not found.
Please check that "/Users/vsts/agent/2.141.1/work/1/s/packages/Xamarin.UITest.2.2.6/tools" is a valid directory and contains test-cloud.exe.
Minimum required version is "2.2.0".
I think a lot of people are having trouble dealing with this actually and I know it has something to do with --uitest-tools-dir OR --build-dir variables.
Keep in mind this I am first trying to do this with Xamarin.Android, if successful I will try the Xamarin.iOS
One clue i do see is when Tom says "I had to chose to build the app solution file in my App Center CI build - not simply the iOS project like I normally would" in the noted article, but I am not quite sure how to do that or if is connected to why AppCenter cannot locate my test-cloud.exe I will also say that test-cloud.exe somehow comes from the Xamarin.UITest nuget, but I do not see any test-cloud.exe file in my Xamarin.Forms project.
This answer works, but it's pretty fragile.
The test-cloud.exe can't be located at packages/Xamarin.UITest.2.X.X/tools in projects that uses the old project structure (projects that use packages.config). For new projects (new .csproj formats), there is no such file in the path of the project. The only way I found to make it work on AppCenter is to use it from the NuGet package cache (/Users/vsts/.nuget/packages/xamarin.uitest/2.X.X)
Kudos to AppCenter Agents for helping me to resolve this. 2 things were required as indicated below:
Agent Anvesh says
Hi there, Thanks for the details, So seems like you are using a nuget as a PackageReference in your project(this means that there will be no package folder in your project, packages will be there at user profile).
So when you are trying to run the test as part of the app center build. Then in the shell script used the --uitest-tools-dir value as below
/Users/vsts/.nuget/packages/xamarin.uitest/2.2.6/lib/tools
So I modified my above script to add the below:
--uitest-tools-dir /Users/vsts/.nuget/packages/xamarin.uitest/2.2.6/tools \
Agent Shawn says
So I added the below
msbuild $APPCENTER_SOURCE_DIRECTORY/MyApp.Mobile.UITestProject.csproj

After I added Sentry to react-native project, apps deployed to itunes store crash (on Android or ios simulator it works fine)

I added react-native-sentry to a react-native project. I followed this manual: https://docs.sentry.io/clients/react-native/
Everything worked fine on Android and ios emulator. But when I tried to archive an app in xcode I got this error.
React native symbol handling failed
The Sentry build step failed while running in the background. You can ignore this error or view details to attempt to resolve it. Ignoring it might cause your crashes not to be handled properly.
If I click 'Show Details; I get this
error: EOF while parsing a value at line 1 column 0
I followed the advice from here https://github.com/getsentry/react-native-sentry/issues/135 and edited Build Phases > Upload Debug Symbols so now there is only this line there
export SENTRY_PROPERTIES=sentry.properties
The error still persisted. So I decided to ignore it. In this case after I upload the version to Itunesconnect and install it with a TestFlight it crashes immediately on start.
If I run it on a simulator or install it directly an iphone it works fine.
It also works fine on Android.
Could you give me any advice what can be done to make it work on Apple Store too?
For me this error was signaled by Xcode because of some problems when running the build scrips.
Using:
https://github.com/getsentry/sentry-react-native
#sentry/react-native": "^1.0.9
I fixed it keeping the index.ios.js always in the root folder (before that I had it in a src folder and trying to use a custom build script to take it from src)
I set the build scripts in Xcode to be similar to the ones from sentry docs:
Build RN code and images script:
// sentry properties file located in `ios` folder
export NODE_BINARY=node
export SENTRY_PROPERTIES=sentry.properties
../node_modules/#sentry/cli/bin/sentry-cli react-native xcode \
../node_modules/react-native/scripts/react-native-xcode.sh
Upload debug symbols script:
I have this script as the last one in Build Phases
export SENTRY_PROPERTIES=sentry.properties
../node_modules/#sentry/cli/bin/sentry-cli upload-dif
"$DWARF_DSYM_FOLDER_PATH"
Note:
1) I haven't tried yet to move sentry.properties file as common for both android and iOS, placed in root folder (with import ../sentry.properties in scripts) but I think that should work too.
2) I used the terminal to test directly the release build:
react-native run-ios --configuration Release --simulator "iPhone 8"
or
react-native run-ios --configuration Release --device "Your Device Name"
In my case the reason was a space included in the name of the hard disk I use to keep the Project, Derived Data and Archives. Looks like the Sentry CLI script doesn't like spaces in the path to the project and it crashes there.
It was enough to rename the disk and update paths to Derived Data and Archives and all is well now.

Android Studio Gradle Build Error: Read Time Out

I have the latest Android Studio IDE installed on my Windows 10 laptop, and it was working fine until my windows operating system made a huge automatic update.
Now, when start my Android Studio IDE, I get the following error and it doesn't build.
Gradle sync failed: Read timed out Consult IDE log for more details
(Help | Show Log) (3m 34s 195ms)
I need help on this.
I encounter this error "Read Time Out", and I simply choose menu item: File -> Invalidate Caches / Restart... to fixed it.
[UPDATE]
I just encounter this error for second time, this time Invalidate Caches / Restart... not able to fix it, but then I try close the android Studio, killall -9 java to ensure all java process has been terminated, then relaunch Android Studio, no more error.
[UPDATE 2]
I just encounter this error and I fixed it by replug the phone cable and rerun.
I got around this issue by turning on Offline Mode in the Gradle tool window.
I have just synced the Project with Gradle files and it worked
Editing global gradle.properties with the following line was the fix for me:
org.gradle.jvmargs=-Dorg.gradle.internal.http.connectionTimeout=120000 -Dorg.gradle.internal.http.socketTimeout=120000
For Chinese users who often use a proxy to download dependency jars, the cause is often proxy settings.
We should check multiple places if the proxy is correctly configured.
Android Studio Settings - Appearance & Behavior - System Settings - HTTP Proxy
${project_root}/gradle.properties
~/.gradle/gradle.properties
In my case, I somehow once configured an HTTP proxy in ~/.gradle/gradle.properties, which was forgotten later. Then when I dealt with a SOCKS5 proxy in IDE Settings and project-level gradle.properties, things always run into trouble. Finally, deleting invalid proxy settings in ~/.gradle/gradle.properties save my day.
I fixed the error by inserting following lines in gradle.properties:
systemProp.org.gradle.internal.http.connectionTimeout=180000
systemProp.org.gradle.internal.http.socketTimeout=180000
This sets the Gradle's connection timeout from the default 30s to 180s (3m).
In my case the read timeout occurred because my computer is behind a HTTP proxy, and it failed to timely connect to http://jcenter.bintray.com.
For more info about the Gradle options, you can refer to https://github.com/gradle/gradle/issues/3370
Simple Answer:
Check the Internet Connection - it should not fluctuate while building the project
File-->>Sync Project with Gradle File
Build>> Clean Project Or Rebuild Project.
I just removed
include ':app'
from setting.gradle and then sync project
it will fails again
then write it back an re-sync and then error gone and will start downloading.
Here's what worked for me (on Windows):
From C:\Users\{$user}\.gradle
Delete these 3 folders:
caches
daemon
wrapper
Then restart Android Studio and Gradle should start downloading automatically
None of the answer worked for me.
I solved it by
Delete project>.gradle directory
File>Sync Project with Gradle Files
In my case it was due to Jitpack.io server down, causing my project unable to build. So I just enabled the Offline Mode for gradle to continue developing my project while Jitpack.io is resolving their server issue.
You will see more info when you click "build" on top of the "read time out" message in build output. In my case, it was a facebook dependency issue so I just had to upgrade it to a newer version.
In my case, it was a firewall issue. After adding Android Studio to its whitelist everything is working fine.
A simple Clean Project + Rebuild Project worked for me
I resumed working on my project after a long time and I was using an Old version of navigation dependency.
after updating version to versions.navigation = "2.3.0" from versions.navigation = "2.3.0-aplha01" my issue was resolved.
so in short make sure you are using latest version of gradle and all libraries (compatible with your gradle version).
Above fixes didn't work for me on MacOS Big Sur 11.5.1 after updating to the new version of Arctic Fox 2020.3.1 Patch 3.
My issue with this was resolved by doing the following:
Close your Android project
Navigate to the root folder of you project
Remove the '.gradle' and '.idea' folders
Start your Android project, which will start the build process. Let this finish
Now the build should succeed. If not, also do an 'Invalidate caches/restart'
In my case, this error was showing up while I am trying to create a new project,
and the default Kotlin Gradle plugin API version was the culprit,
While building/Gradle sync I noticed that the sync process is always getting stuck at the downloading kotlin.gradle.plugin.api:1.5.21,
So I searched for 1.5.21 in the build.gradle and updated it to the latest version, and it worked.
Just Simple Step and you Got Solution.
Android Studio -> FILE -> Invalid Caches / Restart -> Invalidate and Restart
Done Keep Code ☻♥
In my case, Android Studio Arctic Fox | 2020.3.1 Patch 4 (Windows)
I have try 3 step/solution;
Delete 2 root folder .gradle & .idea but still give 'Read timeout'
Invalid Caches/Restart also resulted 'Read timeout'
Close Android Studio, repeat solution 1, monitor 'Build Output' log, then choose 'Disable gradle offline..." , wait and let Android Studio do its thing, then on the log Build showed "BUILD SUCCESSFUL in 28s". Then, I try to run the app just to check and my apps still work as usual.
*Remark: This case happened might be because of my Android Studio IDE Version outdated. As for now, latest version is Android Studio Dolphin | 2021.3.1 Patch 1 .
This error got due to the internet connection during gradles files connection interrupts.
I tried the following techniques but unfortunately, didn't get any solution.
File->Invalidate Cache.
File->Sync Project with .gradle files
Delete Project .gradle and .idea files.
I got the solution to update gradle-wrapper.properties 6.8 to 7.1 after successfully sync revert back from 7.1 to 6.8
#distributionUrl=https://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-6.8-bin.zip
Use the following code in gradle.properties :
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
org.gradle.daemon=false

Import .ProvisionProfile when using Circle.CI and FastLane

For my personal project, I am using Circle.ci to test and deploy the OSX application (with upload hook to S3, to distribute it outside the AppStore - using the signed with Developer ID distribution method). I am using FastLane to build the app, which works flawlessly when building it from my local terminal, but I cannot get past code signing step when using the CI server.
The issue is very simple, the keychain does not import the provision profile, which I can tell from the pre-build step:
1 key imported.
No provisioning profiles found in repository.
You must add a provisioning profile to your repository
to enable CircleCI code-signing support.
Currently installed Code-Signing identities:
Policy: Code Signing
Matching identities
0 identities found
Valid identities only
0 valid identities found
I have my .p12 with private key and certificate uploaded to the repository, no issue there. I have also added the .provisionprofile to the repository (root, even different locations) but to no avail. The documentation states (https://circleci.com/docs/ios-code-signing/) that there is a need for .mobileprovision, but that only covers the iOS, not the OSX, while the system should be nearly identical so I assumed that would work as well.
So the TLDR question is: How do I import the provisioning profile of the OSX distribution on the Circle.CI, so the keychain accepts the entry? Or is there a way around it - like skipping the signing step (disabling it in XCode) and signing it by hand with some .sh?
Thanks everyone!
I am sharing my experience of deploying iOS app to Testflight using CircleCI. Maybe this helps.
Put the provision profile file in the root of your project directory. Make sure it is a normal "Distribution Profile" not a App Store submission profile.
Just add the .p12 key in the project settings of CircleCI. Remove all other certificates / .p12 file from the repository.
I tried using fastlane to build and distribute the build but it was failing in CircleCI. I had these three steps in my Fastfile beta environment.
increment_build_number
gym(scheme: "myScheme”)
pilot
I changed that to just
increment_build_number
My Circle CI file
machine:
environment:
GYM_CODE_SIGNING_IDENTITY: "iPhone Distribution: Company Name (XXXXXX)"
xcode:
version: "8.0"
test:
override:
- set -o pipefail && xcodebuild -workspace 'my.xcworkspace' -scheme 'myscheme' clean build test -sdk iphonesimulator -destination 'id=AC291080-8EFE-4095-8C55-B1E952EFFC36' CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE=
dependencies:
pre:
- gem update fastlane
deployment:
beta_distribution:
branch: master
commands:
- fastlane beta
- gym --scheme "myscheme" --workspace "my.xcworkspace" --export_method app-store --use_legacy_build_api false
- pilot upload

Is there a way of automating the process of refreshing profiles for XCode / XCodeBuild?

I'm setting up a CI build machine and wondering if there is anyway of making sure the machine always has an up to date set of profiles.
If a new device is added to the provisioning portal for example then the CI build will fail until Xcode
/Organizer has its profiles refreshed.
Is there an XCodeBuild command for doing this so that I can automate it (within Jenkins)?
This answer might be helpful, but I haven't implemented it yet:
Command line Update of Provisioning Profiles
For our system, I was just planning on putting the profiles into version control and then running those commands in a prebuild shell script.

Resources