How to write apps for iOS 12 in Xcode 11? - ios13

I just installed Xcode on my new MacBook. The new starting templates for Swift iOS require iOS SDK 13+ (ie they either need UISceneDelegate or SwiftUI). Is there a way to create a new app using a built-in template that is compatible with iOS 12?

The steps to getting to an iOS 12/13 app:
1) Change deployment target to iOS 12.
2) Replace the AppDelegate's methods with what they ought to have for iOS 12 development. Also add this:
var window: UIWindow?
3) Remove SceneDelegate.
4) Remove Application Scene Manifest in your info.plist.
Originally answered here

First of all, Make sure to not selecting SwiftUI as user interface in template picker (select storyboard instead). Because SwiftUI requires iOS 13 (You can have SwiftUI only for iOS 13 and above beside UIKit for below iOS 13 at the same time, but it has some more extra work to do):
Second of all, make sure to choose lower target dependency (like 12.4) in general tap of the project settings:

Another option is to use some simple template or example project.
https://github.com/PacktPublishing/The-10-Day-iPhone-App-Bootcamp---New-iOS-12-and-Xcode/tree/master/S01
You need to download that zip ,and open project file "Swift Fun.xcodeproj" with xCode 11
I use this to start and learn, this may help you.

Related

How to include Android.Support.v4 in Xamarin Forms (iOS)?

I am using Visual Studio For Mac. My Xamarin Forms project is quite large and contains many content pages. Some of them will be only used in android project and some of them only used in iOS project. There is no problem when I compile the project into android. However, when I want to compile the project into iOS, it seems like did not accept anything related to android. Please refer to the screenshot. There is no way I can include the android specialised reference and compile into iOS project. So, any idea to deal with this? Maybe there is a way to force build the iOS project no matter what? The error from the screenshot is from the page that will be only used in android. So what I can do for now is delete the page when I want to compile as iOS and recreate the page when I want to used it for android. But there are plenty of them, it is too heavy for me to do this every time. Please help.
You can't call platform specific APIs at the .NET standard libraries that are used to host Xamarin.Forms code by default.
Basically you have those options:
1) using shared project instead of library and using conditional compiling (easier but it is now not available as the option when creating the project)
2) using dependency injection.

ADB0020: Android ABI mismatch. How do I set ABI of target physical device?

I have a brand new Samsung A10 with Pie on it.
I'm attempting to run the Sample Application provided in MediaPlugin:
https://github.com/jamesmontemagno/MediaPlugin
At first I was getting this error when I tried to build:
Invalid value 'armeabi' in $(AndroidSupportedAbis). This ABI is no
longer supported. Please update your project properties to remove the
old value. If the properties page does not show an 'armeabi' checkbox,
un-check and re-check one of the other ABIs and save the changes.
Then I did some reasearch and went to Android Properties / Android Options / Advanced and unselected armeabo-v7a.
As I understand it this will remove 32 but support, which I'm fine with.
Now I get this error:
ADB0020: Android ABI mismatch. You are deploying an app supporting
'x86;x86_64;arm64-v8a' ABIs to an incompatible device of ABI
'armeabi-v7a;armeabi'. You should either create an emulator matching
one of your app's ABIs or add 'armeabi-v7a' to the list of ABIs your
app builds for.
I'm targeting a new A10 Samsung phone with Android Pie on it. I can't see where to set the 'device ABI', though why would a new Pie phone be interseted in armeabi-v7a anyway?
Where can I set the 'device ABI' or otherwise fix this?
I can't find anything on Google. Thanks.
UPDATE
I've found this work around which is as worrying as it is bizarre:
Untick the armeabi-v7a option
Build
Re-tick the option
Build
Deploy
from
https://forums.xamarin.com/discussion/146174/vs2019-error-this-abi-is-no-longer-supported
I'd like to understand what's going on here rather than just work around it.
This is only an issue with my A10 physical Samsung phone, in emulators it seems to work fine.
I got this error before. You could untick all the supported architectures to tick all of them like below. Delete the obj and bin folder of project to clean and rebuild. Most of times, it works.
Different Android devices use different CPUs, which in turn support different instruction sets. Each combination of CPU and instruction set has its own Application Binary Interface (ABI).
For more support of Android ABIs, you could refer to the Android ABIs guides.
https://developer.android.com/ndk/guides/abis
To fix this issue on a Xamarin.Forms Android application, Right click on your android project and then select Properties > Android Options > Advanced.
You will see a dropdown for supported architectures. Select x84 & x86_64.
The app should now build and run on the emulator.
go to your project folder and edit yourproject.csproj
and remove starting <AndroidSupportedAbis> line completely.
add:
<AndroidSupportedAbis>armeabi-v7a;x86_64;arm64-v8a;x86</AndroidSupportedAbis>
save and debug. (changes accept on visual studio)
Enjoy.
Do not setup retry abis on xamarin.
I changed to Debug mode from Release mode after signing a release.
For Mac:
Android Project -> Option -> Android Build -> Advanced. Then tick all.
Click Option from Solution Explorer for Android:
Click Android Build then Advanced:

Xamarin Forms WatchOS main iOS app couldn’t be found

I am trying to create a watchOS app in an existing Xamarin Forms application in Visual Studio 2017 on Windows. I have followed all the steps listed here. I have also added watchOS app project reference to the main iOS app by selecting add reference option of the references node of the main iOS app. Solution also builds successfully but when I try to launch watchOS app in watch simulator, it instantly throws the below error without even launching the simulator.
Error:
Main iOS app couldn't be found, please make sure you've created an iOS app and it is referencing
Please suggest what I am doing wrong.
I think you have add the watchOS app reference in a wrong place.
You should add the reference in xxx.iOS projecct instead of xxx(xamarin.forms project).
Let me show a screenshot for you:
Update:
Steps:
I create a new MobileApp(Xamarin.forms) project(platform iOS).
Right click on the solution -->add --> new project -->Apple Watch -->watchOS app-->ok.
Right click on the xxx.iOS project --> add---> reference --> check XXX.watchOSApp
Right click on the xxx.WatchOSApp --> Set as Setup Project.
(Clean and rebuild) Run on the appleWatch simulator.

How do I change the iOS version for the Simulator?

Environment: Version 8.2 beta (8C30a)
My schema list only devices.
How do I change the iOS version in simulator?
I can see the available iOS Simulators...
...but they're not listed in the schema list.
Nor is their a way to discriminate amongst the iOS versions within schema manager.
The list of available simulators is dictated by three factors:
It will not show you simulators whose iOS version is prior to that of your current app's deployment target. If you want to see some recent, prior iOS simulators, make sure your app's deployment target is set accordingly.
If you go to Xcode "Preferences" - "Components", you can confirm which iOS simulators are installed on your machine.
In Xcode's "Devices" window (shift+command+2), as shown in the snapshot in your original question, you can configure particular simulator devices for your Xcode environment.
Open your xcode and press command + shift + 2.
Click on left bottom + button and your new simulator with required iOS version.
Click create, now you are ready to use the new simulator.
After adding the #availability & #availability flags which allowed me to get a successful compiled under and older distribution target, I noticed that the iOSes came back:

Visual Studio Apache Cordova - IOS build rotation issue

I'm a starter in writing app code in Visual Studio 2013 Community Apache Cordova and have managed to connect VS2013 with my Mac. Once I have gone through the process of building the app in VS and on my Mac and installing in on my iPhone, I open it up and it won't rotate. It doesn't rotate for a number of basic apps that I've written nor does it rotate if I build the default new project "Hello, your application is ready!" app.
I have done some research and tried changing the config.xml "Orientation" preference to "both", through the code window and also in the designer window but that doesn't change anything. I've also noticed that adding in a "BackgroundColor" preference doesn't work either.
Does anyone know if I may have configured something incorrectly or perhaps need to add something to my code?
All the HTML, JS and CSS that I've written seems to work okay (with the exception of trying to link URLs to the Safari Browser but that's another issue).
I have noticed the same issues. I tried finding some settings to fix that in the config.xml, but was not successful. I have resolved myself to just opening the iOS project in XCode and changing a few things:
Device Orientation: no matter the config.xml setting, its always only Portrait. I click-check the other 3 orientations.
Team: I have multiple developer profiles, and I need to choose correct one here.
Bundle Identifier. I screwed up one project, and have different case for iOS and Android. I leave the VS one as the Android one, so I can build completely correct for Android. Since I know I have to go to XCode for iOS anyway, I change the bundle identifier here.
You can find the project using Finder at ~/remote-builds/builds/9999/cordovaApp/platforms/ios/*.xcodeproj, where 9999 is the build number, though not necessarily the latest, largest number, but the latest datetime of the folder.
You can also refer to Greg's answer in this related post as an alternative solution.

Resources