Trying to build my own framework, i followed this tutorial
https://github.com/sammyd/RW-iOSFramework/blob/master/BuildAFramework.md
on how to build a framework.
and i noticed there is an issue with loading images from bundle
I downloaded the final result at
https://github.com/sammyd/RW-iOSFramework/
and after running the app i noticed that the 'ribbon' image isn't shown.
placing a breakpoint at RWRibbonView.m at
UIImage *image = [UIImage imageNamed:#"RWUIControls.bundle/RWRibbon"];
result in image = nil.
anyone know how to extract the image from the bundle ? or direct me to a different tutorial ?
p.s before testing, i changed the scheme to the aggregate and build it just to make sure.
Thanks!
This problem seems to manifest itself in Xcode 6 - where, rather than copying the resources bundle into the dev app (as expected) it instead attempts to link against it. You can see the problem in the following image:
You can fix this by dragging RWUIControls.bundle from the "Link Binary With Libraries" section to the "Copy Bundle Resources" section:
Note that this change has been made in the repo on Github, so you should not have any problems if you pull the latest changes.
https://github.com/sammyd/RW-iOSFramework
Hope that helps
sam
Related
If followed these instructions: https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/images-icons/launch-screens?tabs=macos
The LaunchScreen never shows up. I am using VS2019 for Mac current build. Followed all instructions to the letter.
Update:
github sample project as requested.
https://github.com/tpitman/Xamarin-Forms-SplashScreenTest
I created a new cross platform forms solution. I downloaded an image of the Xamarin logo. The project already has a LaunchScreen.storyboard. It also already had an image view object, but I deleted that and added a new one because the steps on that link above said to add one. I also added the label just like those instructions say.
You will notice when you run it that the label shows up, but the image does not. That is the problem. In my app I don't have or need a label. I just have an image I want to show.
Update 2:
I deleted the above repo. Created a new project including Android this time (not sure that matters, but it represents my real situation).
I also changed the image I used from the stock one to my own in case that matters.
I then built it and it does NOT work as the original one didn't. Hopefully it won't work for you as well.
I also created a video of it not working. Here is the link to that video:
https://drive.google.com/file/d/1Uy0KfDq0_5IfrqDDaMVDNeGylibzUH5m/view?usp=sharing
Update 3:
In the end I am not sure what fix it. I removed and reimported the images. I have 3 projects and 2 of them work fine now using the Assets.xcasset method and the other one I couldn't get to work that way, but works with the images being in the Resources folder.
I think one thing that I did that seemed to make a difference was I did a clean and then build and that seemed to fix it.
I have checked the shared github sample project, it works in my local site. Both in VS for Mac (8.8.4) and VS for PC(16.8.3).
==================================Update================================
There is a workaround to solve that, you could add Image to Resouces directly.
Then use it in LaunchScreen.Storyboard, then it will show:
I have a little problem with xcode. I've already seen this question/problem but the answers couldn't help me this time (yes, I've had this problem in the past).
So my problem is, that xcode is not loading my images/external files while testing/running the app.
If I put my images in xcode without folder, so just the images, it loads. But when I put them in a folder (and some sub-folders) , xcode can't find the images anymore when I'm running the app (in the storyboard it can finds them).
I've already cleaned the app and re imported the images.
Also it isn't a problem with just 1 project, if I start an all new fresh project, I have the same problem.
I hope I've explained my problem enough, if there are questions, I'll be more than happy to answer those.
Also if you can help me out, I will be thankful forever! This problem is really slowing down the development of our app.
Have a nice day!
Try putting the images into the .xcassets folder where your AppIcon is. Also, add files individually into the .xcassets and not drag a whole folder of images into the project.
Sorry for the short answer but you could add more information to the question like images of your folder structure and how you call the image
I have added an image set to the asset catalog (in Xcode) and then intended to access this in code.
The code I am using (in AppCode) is...
UIImage *image = [UIImage imageNamed:#"Photo_Placeholder"];
I know this works and is correct. However, AppCode is telling me "Resource Not Found".
I know that this is only a warning and the build works anyway but I wondered if there is a way to get AppCode to recognise the names of the image sets in an Asset Catalog? At the moment it auto completes the image name based on the files not the image set name.
Sorry for the inconvenience, it's a known problem in current AppCode version. Please, follow this issue in our tracker to receive updates.
I am trying to load a .PNG image located in my XCode project as UIImage - but the constructor of UIImage that takes file name returns nil.
Please see the screenshot for my setup:
Here are some details:
The project is in Swift
I am constructing the UIImage in global variable (lazyly)
The issue is pressent in simulator and on the device (iPhone 5S)
I have added same image several times with different names to make sure incorrect naming is not the cause (see all the names in left red rectange)
all images are added to EasyTypeShared target, which is a library project embedded into runeable EasyType project.
I did not do any axtra steps - just added the image files to my workspace (and the EasyTypeShared target) and run the app
EDIT: According to this blog the cause might be that workspace setup - more preciselly that the image is being loaded by framework. Not sure but in lack of better ideas I will follow this track. If you can cast some light on the matter I would by really thankful for any ideas.
The problem was caused by the fact that code loading the image from resources resides in framework. Main bundle does not contain resources for the framework, the corresponding bundle needs to be used. Working code:
private let imagePlaceholder = UIImage(named: "ImagePlaceholder.png", inBundle: NSBundle(forClass: CarretMoveController.self)
Are these part of the images.xcassets? If not they will have to be read using NSBundle and getting a path/URL for the resource and all that and a simple filename will not suffice.
You can add the files to the assets as per the Apple documentation here. Relevant section might be the 'Adding Image Sets' one.
If you do not have images.xcassets, you can add it to your project as per one of the answers given here.
in your project explorer I can see that images are not named properly.
it should be like this:
imagePlaceHolder.png
imagePlaceHolder#2x.png
notice the png at the end of the file name, and #2x before the file extension.
I've been stuck with a huge problem for a few days now and it is very frustrating. Everything was working perfectly until I messed around with target settings/provisioning a few days ago. Essentially no images are being copied from the project to be included in the app bundle.
I have:
Double checked their case consistency
Made sure they are all included in copy resource bundle section of
build phases
Performed multiple cleans and manual clean outs of the derived
data folder
And the images appear fine in the simulator.
I really don't know where else to turn or what else to try. Any help in solving this would be HUGELY appreciate as I am trying to release an update for an app but am unable to do so before getting this fixed.
ALso it is worth mentioning ever since this problem started occuring it happens in all of my xcode projects.
Check the build log. It's in the "Log Navigator" tab (press command-7). The build log graphically shows the results of the build steps.
Check the path of the individual "CopyPNGFile" steps. You can also open the textual log by clicking the far right button in each build step.