Xcode 9 - Could not load the “sampleImage” image referenced from a nib - swift

I converted Swift 3.1 to Swift 4.0 syntax using Xcode 9.0 beta, and I have a strange problem. My images in Assets folder in the project are not loaded on my real device. I receive this information Could not load the “sampleImage” image referenced from a nib. Everything works fine in simulator. Can somebody explain me, why?
Update
After updating my iOS to iOS 11 I can see images in my app. But does it mean, that apps installed on iOS 10 and earlier will have a problem with displaying images?

I doubt apps running iOS 10 and earlier will have problems displaying images. In my experience as an iOS developer when you update to a beta Xcode release and Swift SDK you have to update to the newest iOS beta to utilize the SDK and test apps. That changes once the beta tags are removed.
The following Apple document states that "The beta OS must be installed on your device (Mac, Apple TV, Apple Watch or iOS device). The beta OS, when offered, is available on the respective developer download page. For example, see iOS Downloads."
https://developer.apple.com/library/content/technotes/tn2249/_index.html

I post an answer to another question about that. Please check this for more detail:
https://stackoverflow.com/a/44683381/3797903
Just convert all your jpg asset to png to make it run on iOS 10 or earlier device.

Related

Xcode 9, iOS 10 issue with Assets

I'm having a problem with assets and Xcode 9 beta running on devices with iOS 10. It doesn't upload any image from assets, so on the phone I can't see any asset!
If I load images in the storyboard, it just doesn't show any image on the phone (but it shows in the storyboard), if I do something:
UIImage(named:"imageName")!
It crashes with log message:
*** Assertion failure in -[_CUIThemePixelRendition _initWithCSIHeader:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreUI/CoreUI-428.6/CoreTheme/ThemeStorage/CUIThemeRendition.m:3788
Could not load the "imageName" image referenced from a nib in the bundle with identifier "myIdentifierName"
This is strange as the same code running on another device with iOS 11 beta works and I can see the images.
I got same problem when I test app on iOS 10.
Check the Xcode 9 beta release note and found known issues about that:
Asset Catalog
Jpeg assets in asset catalogs are not found on iOS 10 or earlier for apps built with Xcode 9. API calls for accessing the image such as UIImage.imageNamed: return nil. (32524123)
Workaround: Use png resources or limit app testing to devices running iOS 11 or later.
After convert all my jpg asset to png. It's works well. Oh...
I got same issue even in xcode 9 beta 4.
Solved by just checking this for Image.
Hope It helps.
Fixed in Xcode 9 beta 3 (build 9M174d)
Jpeg assets in asset catalogs are found on iOS 10 or earlier for apps built with Xcode 9. (32524123)
Make build with ios 11 device or generic ios device

Testing an app developed with SDK6 on iOS7 device

I have an app I want to update of other reasons than change of of iOS, and the work to redesign it for iOS7 is rather big and also not looking good with iOS7.
If I build it with SDK6 using Xcode 4, how do I test it on a device running iOS7. Or do I have to see how it behaves when it is coming up at App Store.
I have also Xcode 5 but with this I can not build it with SDK6, can I?
I can see the result in the iOS6 simulator after a SDK7 build but since the app does not look good with that I do not want to update it that way.
The look is ok on a iOS7 device I know, but how to test it ??
And my devices running iOS7 are not compatible with Xcode 4.
The best way for you is to install Xcode 5 keeping Xcode 4 on your Mac.
For that, copy past your current Xcode 4 in a folder named Xcode4 on your application folder and renamed Xcode.app to Xcode4.app.
After that, update your Xcode to Xcode 5 and create a symbolic link to have the iOS 6 SDK on Xcode 5.
Have a look here, where I explain how to make this symbolic link.

Is there any way to develop iPhone app under iOS6 that targets iOS 3.1.2?

I have a very frustrating experience with recent iOS development. The situation is:
I have developed an iPhone app which targeting iOS 3.1.2, and I am about to submit to AppStore.
What I received from Apple after submission is:
I have to support iPhone 5 tall screen.
The reject message is:
iPhone 5 Optimization Requirement
To support iPhone 5, I need to update the UI and include a launch image: Default-568h#2x.png
After having the Default-568h#2x.png included, Apple rejected my submission again with reason:
Invalid Launch Image - Your app contains a launch image with a size
modifier that is only supported for apps built with the iOS 6.0 SDK or
later.
OK, I am kind of stuck, Apple force me to support iPhone 5 screen, yet, it doesn't allow me to upload app under iOS 6 with iPhone 5 tall screen support.
So I try to compile the code with iOS 6 SDK, then what I find is in order to support iOS 6 I need to have XOS 10.7. Mine is 10.6.8.
To support 10.7 I need to upgrade my Mac to have 2GB memory and i3 duo core CPU and brah brah brah brah...which I don't have at the moment.
So, my question is:
I have XCode 3.2.2, XOS10.6.8, I want to develop iPhone app for iOS 3.1.2 and able to publish in AppStore, how can I do it?
Thank you.
Regards,
Apple will not accept an app targeting an iOS version that old. I don't think they will accept anything less than 5.0 anymore (might be 4.3 but I doubt it).
Sorry, but Xcode 3.2 is years old at this point. Apple simply doesn't support this. iOS 3.1.2 has such a negligible install base that there is almost no reason to target it any more. To support the latest features of iOS (e.g. iPhone 5 support) you need to be building apps with the latest SDK, and you will need to upgrade your development machines and Xcode. You have no choice.

We intend to support the iPhone 5, do we need to upgrade Xcode to v4.5 and use the iOS 6 SDK?

We want to update our game to support the iPhone 5.
Do we need to upgrade Xcode to v4.5 and use the iOS 6 SDK??
[edit]Apple is now explicitly rejecting applications submitted with the iOS 5.x SDK and iPhone 5 default images, saying "Your app contains a launch image with a size modifier that is only supported for apps built with the iOS 6.0 SDK or later."
Old answer :
Yes you can use Xcode 4.4 or below to support iPhone 5.
The iOS (6) will run an app in letterbox mode if there is not a 640x1136 splashscreen image in your resources. The image must be called Default-568h#2x.png (if your splashscreen is Default.png in your Info.plist).
So just add this image on your Xcode project whatever version it is, and the app will run in full screen mode.
This being said, there are chances that Apple will not let you install an app compiled with Xcode 4.4 or below on an iOS 6 device (and of course no iPhone 5 simulator for Xcode 4.4 and below). [edit] As told in the comments, yes, you can install on an iPhone 5 / iOS6 with Xcode4.4.
All apps created with older SDK works perfectly on newer iOS versions, so iPhone 5 should also run every existing app without any problem, so you don't need to use the iOS 6.0 SDK to support iPhone 5.
I think you mean to ask to support iOS 5. If that is the case then you really do not need to upgrade your Xcode version. YOu can use iOS SDK 5.0 or iOS SDK 5.1 which contains Xcode version 4.2 and 4.3.
You really do not need to use iOS SDK 6.0 beta. I hope this may help you.
All the information about iOS 6 are under NDA, and the iPhone 5 is not even announced.
But there are rumors, that the iPhone 5 will have a screen resolution of 1136*640. There are hacks for Xcode 4.4.1 out there that make it possible to create that screen resolution in the iPhone simulator. So, I think that would be a viable way for testing the rumored new resolution.
Regarding iOS 6: if you are a paying iOS developer, you can download iOS 6 to test your app against it (We don't talk about products under NDA here).
You can use this receipt http://0xced.blogspot.co.at/2012/08/prepare-your-apps-for-new-iphone.html for start iOS Simulator (iOS 5 only) with new screen size.
Yes, You need to update your Xcode to build for iPhone5. Do the following steps for this:
Download Xcode 4.5 with iOS 5.1 SDK.
Build your apps with Xcode 4.5.

Testing on iOS 3.1 simulator

iOS project. Base SDK 4.2, deployment target 3.0. A customer is complaining about an issue on iOS 3.1 (he has an old device).
I tried installing Xcode 3.2.3 - the oldest there is for download. It does not offer iOS 3.1 as a test target. Does anyone know how can I enable older versions of iOS on the simulator?
The box also has Xcode 4 (in a different folder). Could it be the case that they're sharing the iOS simulator, and the backwards-incompatible one from Xcode 4 is getting in the way?
There is no substitute for testing on a real device.
I've had a problem with my iPod touch (3rd gen, ios 5.0) crashing in one app. Every day. The dev won't buy, beg, borrow or steal a real iPod touch to test it on so he can fix it. As a user this is extremely frustrating.
EDIT:
The final versions of Xcode with the iPhone SDK, as it was called then, are not available from Apple's download page, but the direct links still work.
The direct links can be found at:
http://chris-fletcher.com/2010/08/28/howto-install-iphone-sdk-2-0-3-1-for-xcode-3-2/
If you use the latest Xcode, you can install device debugging support via the Downloads->Components section, a la: http://cl.ly/3U1V1G3W2p2E1G29342e
http://iphonesdkdev.blogspot.com/2010/04/old-versions-of-iphone-sdk.html
Some of the links are dead though. Apple is removing those old files little by little. Get them while supplies last.