Install IPA file from server and install programmatically - xamarin

I want to download ipa file from server and install programmatically. I want to do same kind of thing in android as well and i have found a way.
Android:
http://bpsinghrajput.blogspot.in/2012/07/how-to-download-and-install-apk-from.html
IOS: ?
Could you please help me.
Regards,
Sneh

You can't install IPA's programatically from within iOS (on a non-jailbroken device).
Some other options are:
If you are only testing then : Upload the Application to Apple's TestFlight and invite testers.
If you are only testing then you can use a web adhoc-install. This requires that the device that is going have the application installed is already registered in the provisioning profile. See: http://gknops.github.io/adHocGenerate/ and https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html
Open a direct link to the AppStore for the application you want to install from within another app. See: How to link to apps on the app store

You can use ideviceinstaller for that. This github gist has a few examples
https://gist.github.com/githubutilities/91ba27c2f5a135dce1a2#file-ios-hacks-md
# list installed app on the connected device
# it also lists the identifier of the installed packages
ideviceinstaller -l
# install ipa
ideviceinstaller -i <your-package.ipa>
# uninstall app
ideviceinstaller -U <your-app-id>

Related

How to install a OSX .provisionprofile on a mac machine via Terminal / CLI?

I want to write a script that installs some OSX .provisionprofile files on a macOS machine, but i cannot find any information online on how to install this type of provisioning profile via the Terminal.
Everywhere, people just mention and ask about iOS .mobileprovisioning which is a whole different thing and they're really easy to install with a script.
Is it possible to install a OSX .provisionprofile via CLI? If yes, how?
Seems OSX provisioning profiles are treated the exact same way mobileprovision profiles are for iOS. This means you can just copy them in "~/Library/MobileDevice/Provisioning Profiles" and rename them to their uuid.
Code example can be found in the answer here: Can an Xcode .mobileprovision file be 'installed' from the command line?

Installing android emulator for android-skd-tools

I am trying to setup android development environment without Android Studio on Windows system. I will be developing an application using nativescript so I followed their tutorial and was able to setup things as mentioned on their page(link). And tns doctor gives "No issues were detected".
Note: I haven't used Chocolatey to manage the installation. I have manually installed the packages that were mentioned on the page.
I created avd using:
avdmanager create avd -n nvDev -k "system-images;android-25;google_apis;x86" -b google_apis/x86
which is also listed by(emulator is under 'tools' folder)
emulator -list-avds
--------------------------
nvDev
Now when I try to start emulator it is giving me error:
emulator.exe -avd nvDev
--------------------------
[3708]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at ..\emulator\lib64\qt\lib
Could not launch '..\emulator/qemu/windows-x86_64/qemu-system-i386.exe': No such file or directory
As emulator folder was not found I tried to install emulator using the sdkmanager but it gives me a warning:(sdkmanager is under tools/bin)
sdkmanager "emulator"
Warning: File C:\Users\CES_Arion\.android\repositories.cfg could not be loaded.
Warning: Failed to read or create install properties file.
There was no "done" message. And even the emulator folder was not created alongside tools.
Wow, I feel so foolish now. The problem was I did not run the command prompt as an Admin so the files could not be created.

Resigning a xamarin android apk using apksigner fails

after having generated a signed apk using archive/adhoc distribute and installed it on a device it works fine.
But when i resign the signed apk using apksigner.bat (from android sdk) using the same keystore and deploy it on a device, the app won't launch.
Adb log:
W/monodroid(12082): Trying to load sgen from: /data/app-lib/com.company.TSMClient-1/libmonosgen-2.0.so
F/monodroid(12082): No assemblies found in '(null)' or '<unavailable>'. Assuming this is part of Fast Deployment. Exiting...
I/ActivityManager(21181): Process com.company.TSMClient (pid 12082) has died.
I checked inside the apk for diff and found that in the META-INF folder the resigned apk has slightly smaller .RSA and .SF files.
Any idea what's wrong ?
I fixed it this way:
I activated multidex and updated pro guard in the android sdk
To update pro guard, replace the existing folder content with the zip you downloaded from the sourceforge site
Please also vote up for Xamarin issue https://bugzilla.xamarin.com/show_bug.cgi?id=44187

Developer ID signed OS X app crashes on start with Code Signature Invalid

I'm trying to build my app such that I can share it with testers. My app specifies entitlements (iCloud) so I have to sign it. To distribute a signed build I think I need to sign it using 'Developer ID', which I've done. The app package appears to be signed correctly - running:
spctl --verbose=4 --assess --type execute <my app>
reports:
<my app>: accepted
source=Developer ID
But when I run the app it crashes - a 'Code Signature Invalid' exception.
So why does it crash? I think I need to include the provisioning profile I've created which includes the UUID's for my tester's machines, but when I try to export the 'Developer ID-signed Application' from Xcode it always lists the provisioning profile as 'None', and there's no way to change it. What am I doing wrong?
I figured out that I was misunderstanding a bunch of things.
Firstly - I'm pretty sure it crashes because although the code signature is valid, I'm trying to use features (iCloud) which are only available to apps downloaded from the app store; the app needs to be signed by Apple to run.
Secondly - Developer ID-signed apps don't use provisioning profiles; these are production-ready apps for actual distribution outside of the app store (so long as they don't use app-store only features).
So how do I share a build so that testers can run it and use its iCloud features? The answer is I build a development build as I normally do, signed as a developer, but create a matching provisioning profile including the UUIDs of my tester's machines. I then export the archived app using 'Export as Mac Application'. Both the app AND the profile need to be passed on to testers - they can install the profile by simply double-clicking on it to bring up the profile manager.
This took me a few hours to figure out - I don't think it's clear from the doc quite how all these things relate, so I hope this is useful to someone! ;)
I recommended to create DMG file and put the app in Application folder:
this is clean and build the proj:
xcodebuild -configuration Release -scheme {SCHEME_NAME} clean build
and create the dmg file:
hdiutil create -volname {PROJECT_NAME} -srcfolder {...}/Xcode/DerivedData/Build/Products/Debug/{APP_NAME}}.app -ov -format UDZO {SRC_PATH_FORDMG_FILE}/{PRODUCT_NAME}.dmg

Trouble packaging and signing iOS apps built with Cordova CLI

Until now, all of my experience compiling PhoneGap apps has been via the excellent PhoneGap:Build service. However, I now find myself in a situation where I need to compile locally, because I need to use a plugin that includes a binary file, which precludes it from being included for use with PG:B.
So for these reasons, I need to compile locally. "Great!" I thought, I'll just use the new CLI...
I have developed my app, and I can test it on-device via deploy over USB from Xcode, but trying to get a release build, and sign it, with the provisioning profile embedded, has been a nightmare.
For completeness, this is the basic outline of everything I've done, aside from the app development itself.
$ pwd
/users/adam/dev/myapp/mobile/
$ cordova create build_local com.foo.bar MyApp
Creating a new cordova project with name "MyApp" and id "com.foo.bar" at location "/Users/adam/DEV/myapp/build_local"
$ cd build_local
$ cordova platform add ios
Creating ios project...
$ cordova platform add android
Creating android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.foo.bar
Name: MyApp
Android target: android-19
Copying template files...
<snip>
Project successfully created.
$ cordova plugin add https://github.com/hazemhagrass/BackgroundJS
Fetching plugin "https://github.com/hazemhagrass/BackgroundJS" via git clone
Installing com.badrit.BackgroundJS (android)
Fetching plugin "https://github.com/apache/cordova-plugin-device.git" via git clone
Installing org.apache.cordova.device (android)
Installing com.badrit.BackgroundJS (ios)
Installing org.apache.cordova.device (ios)
$ cordova plugin add de.appplant.cordova.plugin.local-notification
Fetching plugin "de.appplant.cordova.plugin.local-notification" via plugin registry
Installing de.appplant.cordova.plugin.local-notification (android)
Installing de.appplant.cordova.plugin.local-notification (ios)
$ cordova plugin add https://github.com/kdzwinel/phonegap-estimotebeacons
Fetching plugin "https://github.com/kdzwinel/phonegap-estimotebeacons" via git clone
Installing pl.makingwaves.estimotebeacons (android)
Installing pl.makingwaves.estimotebeacons (ios)
For what it's worth, this last plugin is the reason that I have to compile locally.
Now, here's one other potential monkey wrench: This app is actually two apps. It's the same core codebase, merged into two different deployment branches of the repo, one for each client. So each app will have its own id, name, and config stuff. Because of this, I actually have more than one cordova project folder (1 for each final app) and after creating each project through the steps above, I remove the generated www folder and replace it with a symlink to the shared www folder that exists outside of these phonegap project directories.
This is supported behavior; the CLI allows you to generate your app with a symlink via the --link-to flag (see cordova help create for details). However, doing so seems to have issues; so I've resorted to doing all of the app config up front and then replacing the generated www folder with a symlink after everything is ready to compile.
At this point, I can deploy to either the iOS simulator or Android emulator, and I can deploy to devices over USB, and everything works just fine; all of my plugins are available and function as expected. So I'm ready to compile a release build. Android is easy. iOS, not so much.
$ cordova build ios
<snip>
** BUILD SUCCEEDED **
However, this is a DEV build. The generated file is in the build/emulator/ folder, and when I attempt to sign it, I'm told that it's not signed because of the I386 architecture (which indicates that it's a development build).
$ xcrun -sdk iphoneos PackageApplication -v "platforms/ios/build/emulator/MyApp.app" -o "/users/adam/dev/myapp/MyApp.ipa" --sign "iPhone Distribution: {our cert name} ({our cert id})"
<snip>
Codesign check fails : platforms/ios/build/emulator/MyApp.app: code object is not signed at all
In architecture: i386
<snip>
I've attempted to generate a release build from the cordova CLI. I haven't been able to find the --release flag documented anywhere, but the CLI doesn't complain, and it usually does if it doesn't recognize a flag.
$ cordova build ios --release
<same result as previously>
Attempting to sign this build results in the same problem.
At this point, I started attempting to work directly in Xcode. I've set the .mobileprovision file and the signing credentials up appropriately, to the best of my knowledge:
With these values set, Xcode no longer allows me to build:
So I'm stuck: I have no choice but to build locally, and I can't figure out how to get it to build for release and sign! Please help!
Additionally, if I attempt to embed a provisioning profile, that fails because of an issue with entitlements. I'm not exactly sure what this means, but I'm hopeful that it's a result of working with a dev build, and resolving that will resolve this as well.
$ test -e ~/.ios/DEV.mobileprovision && echo exists
exists
$ xcrun -sdk iphoneos PackageApplication -v "platforms/ios/build/emulator/MyApp.app" -o "/users/adam/dev/myapp/MyApp.ipa" --embed "~/.ios/DEV.mobileprovision"
<snip>
error: Failed to read entitlements from '/var/folders/zs/j2hmt69n12sbjm6gyn0m_q4c0000gn/T/tyYvYPQKf3/Payload/MyApp.app'
Update 1:
This SO question helped in one regard. I don't know how the active scheme (I'm not really sure what that means, but that's the tooltip when I hover over the control) got changed as part of specifying keys/etc, but clearly it did. Changing this back to an iOS Device, like iPhone, allows me to build my project, and even Archive (which, to the best of my understanding, means it's creating the .ipa file I need to submit to the app store), but I can't find the archived file. Where should it be? Can I define this in a setting somewhere in Xcode?
Update 2:
By fiddling with certificates and provisioning profiles I've finally been able to create an archive from Xcode, which I've been told is a release build (is it?). Ideally I would like to be able to build from the command line so that I can automate it as much as possible, so that's where I'll be picking up in the morning. Any advice on that front would be quite welcome!
If you managed to create an archive in Xcode, then your signing certificate and provisioning profiles are known to Xcode, so cordova build ios --release --device should make it.
The steps are:
1) Import your iOS developer certificate for production to the keychain by downloading and double clicking on it in Finder (or get it via Xcode)
2) Download your provisioning profile (with the App ID set to the id attribute of the widget element in config.xml) and double click it on Finder so it goes to the Xcode provisioning profile store
3) cordova build ios --release --device
it looks like you're trying to sign the app with a wildcard provisioning profile (the XCode screenshot). Can you try creating and downloading a distribution certificate and provprofile to your Mac? Then import the .cer file in the keychain access app (doubleclicking should suffice) and doubleclick the provprofile as well.
Now you should be able to select the appropriate values from the release dropdowns in the XCode build settings.
Hope this helps somewhat...
Eddy
One other issue I am seeing from your screenshot is I don't think you can Build an Archive (Release) version using the Developer Signing Idenetity, you would need to create a Distribution certificate and use that one for the Release (Archive) version.

Resources