Custom Expo Development Client for Simulator - ios

I had a specific question about installing a custom expo development client on a simulator, specifically an iOS simulator. I know that there is a way to install an expo build in a simulator (outlined here: https://docs.expo.dev/build-reference/simulators/), but this is just a build and not a development client, which are two very different things. The concept of an expo development client is outlined here: https://docs.expo.dev/development/introduction/. That means there is no Fast Refresh available, and I cannot modify my app in real-time by changing my code. This is a really important feature for me because I need to make sure my app is compatible with all iPhone sizes, and I need to be able to see the changes quickly without having to make a build every single time. Does anyone know how to do this, or if this is currently even possible?

A more detailed explanation of the issue can be found here: https://expo.canny.io/feature-requests/p/custom-dev-clients-for-simulator
Essentially the issue that I had was I did not set up my eas.json file correctly. I needed to change the preview build profile in the eas.json file so that it contained these parameters: "developmentClient": true and "ios": { "simulator": true } I then built my project using the command eas build --profile preview. I then followed the steps of downloading the tar.gz file, extracting the .app file, dragging it into the simulator, and I was able to successfully open the app and connect it to Metro where I could then see live changes.

Like #Raamiz Abbasi said, you can set developmentClient and simulator to true in your eas.json however if you want to go further, you can also use expo-dev-client to create a "custom expo go app" which is basically a customized expo go which you can publish updates to with the eas-update.
Expo Go and this new "development client" are both clients which serve the purpose of displaying your JS bundles. But, with the expo-dev-client you can do cool things like add extra debug buttons into the menu, or run publishes (or eas updates in this case) which would automatically feed into the dev client.
The reasoning for doing this, besides adding extra debug stuff in the debug menu, would be to avoid the pain of only being able to expo publish a "release" build. Right now expo publish builds used with expo go cannot be debuggable.

Related

How to test the purpose string of NSPhotoLibraryUsageDescription in iOS using Expo?

I've been struggling to verify if the purpose string for photo library access really is working as expected. It started with the application got rejected because it wasn't set.
Using expo-image-picker, it says in the docs that adding this into the plugins section in app.json should set the NSPhotoLibraryUsageDescription:
[
"expo-image-picker",
{
"photosPermission": "This allows you to upload a photo to your Appname profile."
}
]
Before I added this, I basically added NSPhotoLibraryUsageDescription to the plist key inside ios section in app.json. What I can see, both do exactly the same thing.
After building ios using expo build:ios I was able to verify that that the string existed in the Info.plist file:
<key>NSPhotoLibraryUsageDescription</key>
<string>This allows you to upload a photo to your Appname profile.</string>
Using Expo Go doesn't really help since when requesting permissions, it says "Expo Go" in the alert.
Also, I only have experience working with Expo / React Native, and have no access to a mac (or xcode).
When apple test this, it looks like this (according to their screenshot):
While the expected text should be:
This allows you to upload a photo to your Appname profile.
How can I verify that the purpose string is really set (and works) before submitting an application to App store?
My solution:
First I set up my app for an EAS build. If you're not familiar with that you should check out the docs: https://docs.expo.dev/build/introduction/
Basically you do this:
install eas-cli: npm install -g eas-cli
run eas build:configure to initialize an eas.config file.
configure your eas build profiles. Mine look like this:
I collapsed the submit block to hide my credentials. Sorry for the photo instead of code/text. The formatter kept messing it up.
Any way, trigger a build using eas build -p ios --profile development. Notice the simulator flag set to true. This will allow you to run this as a stand-alone binary in your simulator.
When your build completes, go to expo.io and log into your account. Click on your project and download the binary for your ios build (under the builds tab). Unzip the binary and drag it into your simulator. You may be prompted with a message that says that you need to start up your development server. Just follow those simple instructions and there you go. You'll be able to see if your NSPhotoLibraryUsageDescription string updated.
Admittedly, this can be a pain in the (insert donkey emoji here - still don't have one yet Apple....😡) and you're kind of executing outside of the expo environment, but it solves the problem of wondering if your string has updated before posting to the store again.
Best of luck. Hope that helps.

iOS Launch Image Works in Dev but not App Store Version

I have an iOS app and I am trying to get the launch screen to work properly. It works fine when I run the app in the simulator or on-device via xCode. But after I upload the binary to the App Store the splash screen image stops working.
I am using Cordova and cordova-plugin-splashscreen.
It looks like it's still trying to load it and comes up with the spinner but the image doesn't appear.
What can cause differences between a local run and an App Store build?
This is what the broken App Store version looks like on initial boot. It eventually does end up loading properly and the app runs fine. But it looks horrible while loading.
When you build and run on local device, you are building using the "Run" scheme, whereas when you build your app for the App Store you use the "Profile" scheme. The Build Configuration for the Run scheme is called "Debug" whereas the build configuration for the Profile scheme is called "Release".
In order to fix the problem and achieve parity, you need to change the build configuration for the Run scheme to "Release". You do that in this way:
Click on the app icon next to the play button on the top left in XCode.
Select "Edit Scheme".
Click on "Run" in the left pane.
Change Build Configuration to "Release".
Close.
Build and Run.
In theory, your app should now run as it does when downloaded from the app store.
https://www.youtube.com/watch?v=kXdzk3qhCWc&list=PLt2cCXacqzgfUAjHYnZ9rrPkih4NzAV4E&index=8&t=94s
I think you need to satisfy the Apple about your launch assets
as shown in above video link may help you. If i understand properly your question.
Thank you.

How to edit the Xcode Project for Meteor iOS integration?

I want to create an app icon, splash screen, edit the app name, and set some cordova / app settings.
meteor run ios opens up the simulator but doesn't open or the project. Where is that project and does this Xcode project ever get overwritten? I don't want to lose any settings I make.
For example I want to set the app url scheme so I can implement a redirect to the app. I also want to set cordova preferences to disallow over scroll. Typically I would do these things from within the .xcodeproj but where is it and when does it get overwritten / reset?
From what i have seen from the docs and my experience so far
meteor run ios only runs the iOS emulator with your code in it. The code related to this build is in .meteor/local/cordova-build but is temporary and will get overwritten all the time
meteor run ios-device -p yourlocalip:yourlocalport will launch XCode with the cordova-built .xcodeproject, and a local server on your computer. It is intended to make you able to run and debug your code from an actual iPhone device, with the changes you make on your computer to the code repercuted instantly on the iPhone screen. You need your computer and your phone to be on the same Wifi to enable this feature. The code related to this build is in .meteor/local/cordova-build but is temporary and will get overwritten all the time
meteor build /Path/To/Builds/Directory/NewBuild -p yourserverhost:yourserverip will actually create the cordova-built .xcodeproject pointing to your real server at the path you specified. From this project you can customize as much as you want BUT you will indeed loose these settings with a new build...
Except if you use the yourproject/cordova-build-override/ folder !
As described in the offical cordova meteor docs under "Advanced build configuration" everything you put in this folder will overwrite the files created by meteor during its build. So you can configure everything in the Cordova/Phonegap way there. If you were able to configure your features through Cordova usually, you will be able to do it there.
Bonus that I have learned the hard way :
Always destroy the .meteor/local folder before building one of those three things, i got stuck in a state where XCode remembered some of my changes to the .xcodeproject and everything was messed up. After destroying this folder, everything went back to normal :)
hope i helped
Mickael
If you are looking for the path to the Xcode project in your filesystem, it is located at:
/path/to/project/.meteor/local/cordova-build/platforms/ios/<project>.xcodeproj
You'll have to navigate to your project directory and open .meteor because it is a hidden file.
Note: If you want to be able to see hidden files in finder on a mac, then type into your terminal defaults write com.apple.finder AppleShowAllFiles TRUE, and then restart finder. Change TRUE to FALSE to only see visible files.

xamarin don't build proper apk with android sdk

Yesterday I was able to build apk files.
Since I have add lots of pictures and ressources to theme the app, and when I want to test it on my device, Visual Studio build me one app that crash.
I set the "Release" mode, I go to TOOL>Publish application, I create a keystore and I build the apk.
I put the code to "Disable Debugging" and I've made the manifest.
When I tried to install it, it works, but the app crash.
The application works perfectly with the emulator.
The weight hasn't really change (some Ko) but the app MUST be bigger because of all the pictures I've put, so something is wrong...
Thanks to help me :-)
I unchecked the "Use Shared Runtime" in the properties>Mono android options:

Install iOS app into xcode simulator?

We're iOS (and other mobile platform) developers and our sales folks routinely need to provide demos of our apps for clients. What we're trying to do is automate a process so sales people can go to a self-serve website and feed the app into their simulator.
Using xcodebuild we can kick off the build process and then present it as a secure download link (via our intranet) but all that lets them do is install it to their iOS device. This is OK except not everyone on the road has an iOS device (or some have old iPod touches, and that's super slow). So, I was thinking that there's gotta be a way to get it installed in their simulator.
I see that others have hacked it in there by zipping up a simulator directory and placing it on another:
http://discussions.apple.com/thread.jspa?messageID=7680994
Set target to simulator, release.
deploy. stop iphone simulator. zip
your app from ~/Library/Application
Support/iPhone
Simulator/User/Applications/ send it
to someone else, and let that person
know to unzip it in that folder, than
start iphone simulator - and you're
done.
I guess we can do this, but it doesn't seem deterministic (or at least, a lot harder to script). I'd prefer to work with the .app but if the only way to do it is with this hacky copy and paste operation, that'll be what we have to do.
Any thoughts?
This could work: https://github.com/landonf/simlaunch/
I have not tried it yet by myself, but from video looks like the application converts .app compiled for simulator to a launcher, which can be used to run the app in simulator without installing it through xcode.
It probably uses the same kind of approach for simulating the app without installing it first that is described here: How to install iPhone application in iPhone Simulator
I know this isn't a direct answer to your question, but have you thought about having a server (eg a Mac mini) that has all the installed software on it? Then they could just use some form of screen sharing to run the app remotely.
I've used the simulator build mechanism above with a number of clients and once they figure out the right folder to drop the actual folder into, it's gone very well.
It's a little bit of a hack as you say but in some cases it also beats having to deal with ad hoc provisioning etc when it's less important to have it on an actual device itself.
I haven't tried it yet but I've heard pretty good things about Test Flight (http://testflightapp.com/) also as a way to distribute demos/betas so that might be worth a look as well.
I just developed a pair of scripts to (a) extract an app from a iOS simulator, and (b) install it on another iOS simulator. https://github.com/christopher-prince/SimAppScripts
Locate the .app bundle in your built products directory, typically under Debug-iphonesimulator or Release-iphonesimulator. Drag and drop that bundle onto the Simulator window and it will be installed (you may need to swipe on the home screen to show the icon).
You can also script this from the command line using xcrun simctl install. The xcrun simctl launch command can also start the application.
Most build systems can be automated (or you can use a post-build script from within Xcode, ordered as the last step) to create a ZIP of the app bundle and put it somewhere for download.
(If having the Archive workflow support creating Simulator IPAs would be useful for you please file an enhancement request at https://bugreport.apple.com)
check out waxsim:
https://github.com/square/WaxSim
http://cocoamanifest.net/articles/2011/12/running-your-ios-app-in-the-simulator-from-the-command-line.html
If you build it for i386 and distribute the .app, I believe this will work.

Resources