I am new xcode and swift lanuage, I am making a ios application with xcode, it is a qr code genrator and I want to make qr code data sync to azure sql database, but I don't know how to write the function to sync data to azure sql database. How should I write the function to sync the result of qrcode generator to azure sql database?
Here is my qr code generator Code:
func Generate(id:string)-> UIImage {
let com = id.data(using: .utf8)
filter.setValue(com, forKey: "inputMessage")
if let qr = filter.outputImage {
if let qrImage = cont.createCGImage(qr, from: qr.extent){
return UIImage(cgImage: qrImage)
}
}
return UIImage(systemName: "xmark") ?? UIImage()
}
how could i sync the result data to azure sql database? do any experts know how to write the function?
To connect with IOS app first you need to create mobile app in azure portal.
for that you can follow below procedure:
Go to search bar in azure portal and search for app service click on that and create new by giving required details:
Click on create, after deployment go to configuration under settings and click on new application settings. In the Add/Edit application setting page, enter Name as MobileAppsManagement_EXTENSION_VERSION and Value as latest and hit OK.
for creating database connection Download the client SDK quickstarts for the following platforms:
iOS (Objective-C)
iOS (Swift)
Android (Java)
Xamarin.iOS
Xamarin.Android
Xamarin.Forms
Cordova
Windows (C#)
Create Azure sql database and copy the connection string of database:
Server=tcp:<server>.database.windows.net,1433;Initial Catalog=<db>;Persist Security Info=False;User ID=demouser;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
Add the connection string to your mobile app In App Service, you can manage connection strings for your application by using the Configuration option in the menu.
To add a connection string:
Click on the Application settings tab.
Click on [+] New connection string.
You will need to provide Name, Value and Type for your connection string.
Type Name as MS_TableConnectionString
Value should be the connecting string you formed in the step before.
If you are adding a connection string to a SQL Azure database choose SQLAzure under type.
In this way you can connect azure SQL database to IOS app.
for more clarification you can refere
1.Create an iOS app - Azure Mobile Apps | Microsoft Learn
2.https://social.msdn.microsoft.com/Forums/en-US/f50195df-0fab-4361-82ac-e75a338b69cc/connect-to-azure-sql-database-from-ios-app-written-in-swift
Related
I'm trying to publish my first xamarin forms app on IOS. I barred the issue of login with the Apple account.
I have 4 questions, please.
1- If I implement Sign in with Apple only for IOS 13+ will it be accepted? :(
2- I'm trying to use Xamarin Essentials to log in to IOS 13+ as shown in this article:
Xamarin Essentials
// Use Native Apple Sign In API's
r = await AppleSignInAuthenticator.AuthenticateAsync();
But I only get back the idToken. AccessToken, name and mail return null. Am I missing something?
3 - And finally I tried to use the plugin.firebaseAuth version 4.0.0-pre01:
Link plugin
// For iOS
var credential = CrossFirebaseAuth.Current.OAuthProvider.GetCredential("apple.com", idToken, rawNonce: rawNonce);
var result = await CrossFirebaseAuth.Current.Instance.SignInWithCredentialAsync(credential);
// For Android
var provider = new OAuthProvider("apple.com");
var result = await CrossFirebaseAuth.Current.Instance.SignInWithProviderAsync(provider);
It provides an example using prism to deal with this, but when I install the plugin in this version the application is no more than a splash screen and closes, without showing an error in the output. What am I doing wrong? :(
The first link seems promising for iOS less than 13 and Android using Asp.NET. However in the application I use only the Firebase ClouFirestone and Firebase Hosting for the Administrative Panel. Is it possible for me to sign in Apple without the services of a different backend?
I am very grateful for any light on the path I must follow
1- If I implement Sign in with Apple only for IOS 13+ will it be accepted?
It depends, if they don't find any other issues or violation, it will get accepted.
2- I'm trying to use Xamarin Essentials to log in to IOS 13+ as shown in this article: But I only get back the idToken.
Apple will only provide you the requested details on the first authentication. After that first authentication, you will only get the User Id so be sure to store the details that first time in case you need them.
This feature needs to be tested on a physical device running iOS 13. The simulator is not reliable, it doesn’t always work properly.
Should follow the design guidelines when implementing Apple Sign In. You can find it here: https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/
How to access firebase database from another firebase app in swift5?
We have two apps in one account one is driver app and rider app.
I am storing data in driver real time database and want to access that database in rider app.
Let me know if anyone have this solution.
To access the same database from two iOS application, you simply create two apps in the Firebase console of that project. This will give you a GoogleService-Info.plist file with information about both apps, and each app will pick its configuration from there based on the iOS bundle ID.
Also see step 2 of register your app in the Firebase setup instructions for iOS developers.
After this both apps can access the same database, as well as all other services.
Here is code to use multiple firebase database in a single iOS app
func initDatabase() {
FIRDatabase().database() // gets you the default database
let options = FIROptions(googleAppID: bundleID: , GCMSenderID: , APIKey: , clientID: , trackingID: , androidClientID: , databaseURL: "https://othernamespace.firebaseio.com", storageBucket: , deepLinkURLScheme: ) // fill in all the other fields
FIRApp.configureWithName("anotherClient", options: options)
let app = FIRApp(named: "anotherClient")
FIRDatabase.database(app: app!) // gets you the named other database
}
Or you can initialize from another named plist rather than a huge constructor:
let filePath = NSBundle.mainBundle().pathForResource("Second-GoogleService-Info", ofType:"plist")
let options = FIROptions(contentsOfFile:filePath)
I'm building an app utilizing the new Action on Google Java API. As I understand from dealing with account linking in Alexa, the initial flow (when the userId in the JSON request is null) should redirect to a sign in form to elicit user consent:
#ForIntent("RawText")
public ActionResponse launchRequestHandler(ActionRequest request) {
String userId = request.getAppRequest().getUser().getUserId();
String queryText = request.getWebhookRequest().getQueryResult().getQueryText();
String speech = null;
ResponseBuilder responseBuilder = getResponseBuilder(request);
if (isBlank(userId) || GREETING.equalsIgnoreCase(queryText)) {
speech = "I've sent a link to your Google Assistant app that will get you started and set up in just several simple steps.";
responseBuilder.add(
new SignIn()
.setContext(speech));
//...
return responseBuilder.build();
While testing in the AoG Simulator, however, I'm not seeing any redirection being done. I'm seeing the following error:
My account linking setup:
where authorization URL redirects to a local mock auth service which is supposed to display a login form. It's accessible (both via localhost and via ssh tunnel, provided by serveo.net reverse proxy in this case). Why Google doesn't redirect me there?
Can someone please guide me how to do this initial handshake in the account linking flow and where can I see the form which the Sign-In intent sent from the web hook is supposed to trigger?
I'd rather not use my phone, as the error message seems to suggest, as the account under which I'm testing in AoG simulator differs from my user ID on the phone.
What is meant by using Simulator as a Speaker? What is missing in my setup?
Is there another Google app that simulates the physical device better, similar to Alexa's simulator?
Normally, you can simulate the account linking, by selecting the Debug tab, there you will find a url, copy-paste it on another tab and you can link your account.
Once linking is done, go to the simulator and type 'cancel' or 'stop', and then 'Talk to speech bank'.
! Don't press reset or Change Version, or you have to re-link your app
But, recently Google has removed this url from debug tab, and I can't find it anywhere...
Simulator as a Speaker, The Surface Dropdown is set to Phone, you need to select Speaker,
but when you try that one, you will receive this error...
Invocation Error
You cannot use standard Google Assistant features in the Simulator. If you want to try them, use Google Assistant on your phone or other compatible devices.
So for the moment, you can't test an Action that needs account linking, using the simulator. You can do it with your smartphone...
UPDATE 2019-03-05:
Google has added the account linking in the simulator, which is now easier to test.
We’re looking at using AWS AppSync for our next mobile project because of its offline capabilities. Using AppSync is it possible to release a mobile app (iOS / Android) with the mobile app database prepopulated with content? This is to avoid a slow mega content download the first time the app connects after being installed.
Yes, this is possible to do. The appsync client allows you to specify your database location as part of the config. Here is some sample code that shows you how it is done
// Set up Amazon Cognito credentials
let credentialsProvider = AWSCognitoCredentialsProvider(regionType: CognitoIdentityRegion, identityPoolId: CognitoIdentityPoolId)
// Specify the location to your custom local DB
let databaseURL = URL(fileURLWithPath:NSTemporaryDirectory()).appendingPathComponent("custom_db_name")
do {
// Initialize the AWS AppSync configuration
let appSyncConfig = try AWSAppSyncClientConfiguration(url: AppSyncEndpointURL, serviceRegion: AppSyncRegion, credentialsProvider: credentialsProvider, databaseURL:databaseURL)
// Initialize the AWS AppSync client
appSyncClient = try AWSAppSyncClient(appSyncConfig: appSyncConfig)
....
You can use this mechanism to include the pre-populated database in your app and then configure appsync with that path for the database.
My cn1 app incorporates loggin in with Facebook and Google+. When the doLogn() is called on Iphone, A Safari page is opened which allows the user to enter their credentials for Facebook or Google respectively. The problem I am facing is that my app has just been rejected by apple because the user is taken out of the app and into safari in order to log in with Facebook or Google and this, according to apple, provides "poor user experience". Apple recommended that I use the Safari View Controller API which allows the display of a URL and inspection of the certificate from an embedded browser in an app so that customers can verify the webpage URL and SSL certificate to confirm they are entering their sign in credentials into a legitimate page.
I notice that Codename one has a WebView component. However I'm not sure if it's possible to open the url in Webview instead of Safari when I call the doLogin(). If it is. How do I achieve this and is Web View the right component to use? Or will I need to use the Safari View Controller API, if so, how do I add this api to my cn1 project, is it even possible?
I would recommend that codenameone incorporate this into their Facebook and Google login features to prevent any future users from getting rejected by the app store.
It appears that this happens automatically on Native Iphone apps - Safari web view opening when logging to FB through iOS 9. For IOS should I try to implement a native Facebook log in then? If so. Where do I start?
final Login fb = FacebookConnect.getInstance();
fb.setClientId("XXXXXXXXXXXXXX");
fb.setClientSecret("XXXXXXXXXXXXX");
fb.setRedirectURI("http://www.mibrandapp.com");
FaceBookAccess.setPermissions(new String[]{"id", "name", "first_name", "last_name"});
fb.setScope("id");
fb.setCallback(new LoginCallback() {
#Override
public void loginFailed(String errorMessage) {
Dialog dg = new Dialog();
dg.setTitle("Login failed");
dg.show();
}
#Override
public void loginSuccessful() {
....
}
});
//fb.doLogin();
fb.nativelogin();
Currently the Codename One build server uses Facebook IOS SDK 4.4, which uses the default behaviour of opening the Facebook app to authenticate - if installed - and the Safari app if it is not installed.
If you switch to the "iphone_new" build target (which will soon be standard) it uses the newer Facebook IOS SDK 4.12, which will (by default) handle the authentication inside a web view in your app.
Running some tests on this approach, I found that, on iOS 9, you need to add the following to your ios.plistInject build hint:
<key>LSApplicationQueriesSchemes</key><array><string>fbauth2</string></array>
I have just committed a change that will include this automatically so after the next server update (probably on Friday), it will just work without this build hint.
UPDATE June 14, 2016
I have just updated this in SVN so that it will use IOS SDK 4.12 by default with will resolve this issue without having to make any changes. The server will be updated Friday - after which you should be able to just send your build (with no special build hints) and it will work.
Codename One uses native Facebook login when the Facebook app is installed and activated. You need to use the Facebook Connect API as explained in the developer guide section.