We have an Xcode project that includes both Retina graphics for a NIB-based UI and a WebView UI. This project builds an app for the Mac.
The project uses two separate build phases to move these graphics into the final app. The first is the traditional Copy Bundle Resource which gets both the 1x and 2x graphics into the application package. The second is a Copy Files build phase which copies the web graphics into a separate Resources destination with a "graphics" subpath.
(This avoids some naming conflicts and lets the web designer use a familiar "graphics/whatever.png" path.)
When building this project, we get a Dependency Analysis Error that says:
Multi-representation image 'whatever#2x.png' cannot be processed by a
Copy Files build phase - try a Copy Resources build phase, or disable
COMBINE_HIDPI_IMAGES.
It's easy enough to turn off the Deployment Build Setting called "Combine High Resolution Artwork", but this affects the graphics used in the NIB-based UI as well as the ones in the WebView UI. With the option turned on, button.png and button#2x.png get combined into a button.tiff in the application package's Resource folder. Without it, the original names are used.
As far as I can tell, the application behaves normally, but since COMBINE_HIDPI_IMAGES is set on by default, I suspect there is some benefit to deploying the graphics as a single file (faster to load and cache, perhaps.)
Ideally, I'd like to only disable COMBINE_HIDPI_IMAGES during the Copy Files build phase. I can't figure out a way to do this, hopefully someone else here can...
Update 8/27/2012
For this particular application, the easiest way to fix the problem was to replace all HTML images with the 2x version. Since the tags specify a width and a height, the images are scaled down by 50% on a non-Retina device. The quality is fine and since they're being loaded from the local filesystem there's not perceivable performance impact.
Update 8/28/2012
Another approach we took was with naming conventions. Some HTML images are specified using CSS (with a media query selecting the Retina or non-Retina version.) To avoid problems with these images being combined into a single HiDPI image, we used whatever.png and whatever_retina.png.
The only way I can think to do it is a bit of a hack, but no one else has answered so as it should work for you.
I suggest you use an xcconfig file on your target (target.xcconfig) to specify the settings you want changed, then have build scripts before/after the phase which replace the current xcconfig with one of two versions (target-on.xcconfig, target-off.xcconfig). This should work, however Xcode may not update the xcconfig file until later (I'm not in a position to check at the moment), you'll have to check.
I'll leave it up to you to figure out the details. More details on (a less hackish variation) of this approach, and how to set it up, can be found at my blog.
Related
We have an MLPackage file in our SwiftUI project. Whenever we try to load Previews on a View file, Xcode gets stuck in an infinite loop of "Build for Previews". The builds succeed, but immediately start another build. So, there's no way to actually see/use Previews.
Note: The warnings are not relevant.
Checking the Console logs (not in Xcode) shows this:
Xcode (PreviewsPipeline)
=== Requesting updating previews for reasons [
File "foo.mlpackage" changed,
Preview Settings changed,
]
Taking the models completely out of the project fixes this issue, so I'm pretty sure they're the cause. We're also encrypting the models at compile time, but that is disabled for Debug builds. We also tried removing the encryption step completely with no joy.
As I (poorly) understand it, the mlpackage has metadata, a .mlmodel file describing the topology, and a compressed weights.bin which contain the NN weights. My guess to what's "changing" in that file is the runtime doing some pre-compilation or decompression and storing the result in that package/file.
Is there a way to tell SwiftUI Previews to ignore certain files, directories, or patterns?
That way the mlpackage file can change and it won't rebuild previews.
M1 Mac Mini, Xcode 14.2 (14C18)
For Xamarin.Android it's simple as it only involves 1 platform (and resources are stored in Projectname.Android/Resources/mipmap-{hdpi|mdpi|xhdpi...}). For Xamarin.Forms on the other hand the code refers to single resources/images and as far as they work on different platforms (the same code and the same resources), I can't find a way to provide resources for different resolutions to be automatically picked up based on the screen size/dpi?
Is there a way to achieve that in common Xamarin.Forms project or shall I go and handle it in platform-specific projects' (Android, iOS) code?
The best thing so far is this plugin Resizetizer. You can have all your images in shared project and all images are generated during build time for all platforms (don't worry about the build time, it is similar to incremental build). This approach will also be in .NET Maui which will be launched with .NET 6.
There is also super nice video which really helpful!
As Xamarin.Forms does not seem to support loading image resources from a mipmap folder at this time,you could put different dpi images into the drawable folder like (Resources/drawable--{hdpi|mdpi|xhdpi...}) like mipmap.Then it will pick up the image based on the screen size/dpi automatically.
I'm creating a RN app that is meant to be some kind of wrapper. It should have multiple targets (like in Xcode) and all its content (images, text, etc.) should be target dependent. Unfortunately, I cannot find any useful informations about how to achieve this without opening Xcode or Android Studio project and create those targets manually (like here). Is there any other solutions for this?
I was still struggling with described problem but I finally found a solution. It's not easy, needs writing a bit of boilerplate code and looks more like a workaround but I hope it will help someone in the future. What I did is I have completed my wrapper app with the resources for one of my targets so I can have visual effect. In the project's root directory I've created a folder with subfolders for each target. Inside each I have put files (images, source code files, other assets) that are target-dependent. Then I've created bash script that takes one argument - target's name. Based on it, it replaces all the target-dependent files from target's subfolder to the original file's destination in the project structure. In this proces all meta-data informations are also replaced so after firing .sh file I can build the app and upload it to both stores. It's really time consuming to create all these apps separately and publish them and it's maybe not the best solution, but at least it works!
On android, you can edit build.gradle files, java or properties, without having to launch Android Studio (which simply uses Gradle)
You can build different type flavours by only changing app/build.gradle
On iOS, that's another story. Project file (.pbxproj) is a mess,and other Workspace/Scheme files are not easy to read or script. So XCode is the way to Go.
I tried to have dynamic target & Info.plist, there are tools to script that like PlistBuddy
in the end, I saw there are many ways to launch a React Native app for developpers. Some prefer the command line, and only VSCode.
Others want to play with native IDE.
By the way, native IDEs are VERY useful.
e.g. : you want to fine-tune your application performance, using XCode view hierarchy debugger or android Studio Layout Inspector (and be sure you don't use to many views), or use any other performance tools these IDEs offer...
In the end, I used react-native-config along with multiple almost similar configs (Info.plist < target < Scheme for each), here's a post giving an overview of the setup.
Fine uploader is 400kb of javascript code and 140kb minified. Since I am not using the UI and only using the API, I would like to build the library without the integrated interface (and hopefully get a smaller lib consequently). Is this possible?
Could not find this in the downloads section.
I've also setup the build environment and built the package myself, but all the files in the _dist dir seem to be bundled with the UI.
Fine Uploader is only 40 kB gzipped, which is compression that pretty much every web server already utilizes. The build is not currently setup to create a bundle without the UI. If you'd like to create such a build, the modules.js file will need to be modified. One place to start would be with a copy of the fuTraditional module sans the #fuSrcUi module. Then, a corresponding entry would need to be added to the concat.js build file. This doesn't seem worth it to save a few kB in my humble opinion, but it's all very possible.
If you're interested in a much more modular upload library where almost every feature is represented as an optional standalone module, take a look at Modern Uploader, which I am slowly developing as time allows. Feel free to open up issues in the repo if you have any questions regarding the future of that product.
I have just started using Unity3d for creating 3d and 2d games for the Windows operating system. So, I learnt the basics and created a simple maze game. When I exported the game for Windows operating system in a folder named Output it created a executable file in that folder and a Data folder. The Data folder contained many files, folders, dlls, etc. But don't want those all files to come there. Is there a way so that I can export the complete game as a executable or manage the structure of the dependencies on my own? If this not possible then are there any more game engines which will allow me to do this, as I have seen many games having such directory structure.
Another problem that I found was that when I ran the game it first opened a configuration window asking me for the resolution in which I wanted to run the game and other settings. But I don't my game to have that kind of pop-up when I publish it.
So, is there any way that can help me structure my dependencies and remove the configuration window. If you know the answer of any one of these questions then please answer.
Thanks, in advance.
Is there a way so that I can export the complete game as a executable
or manage the structure of the dependencies on my own?
As far as I know, you cannot configure how a Unity app is built.
You could try using a packager application that takes the build directory and generates a single executable file, as described in this question: https://superuser.com/questions/749447/creating-a-single-file-executable-from-a-directory-in-windows . Beware that not every application can be packaged this way, in particular I don't know if these tools work well with Unity applications.
remove the configuration window
You can avoid the configuration window using Build Settings -> Player Settings -> Resolution and Presentation -> Display resolution dialog: enable/disable . Check he following question: http://answers.unity3d.com/questions/134444/is-it-possible.html .
Unity also will show a startup screen, which you can customize or remove if you are using the Pro version.