Introducing our new consulting website

Introducing 953 Tech Consulting

After 15+ years building mobile, AI, and cloud systems for teams like UBS, Bosch, Google, and Singapore Airlines, I’ve launched a home for the work I do independently: 953tech.com.

I started this practice for one reason — too many good product companies overpay for engineering they can’t fully evaluate. I sit on your side of the table.

Here’s what you’ll find here. Estimate audits that catch the 2x–5x padding vendors quietly build in. Hands-on consulting across native iOS and Android, Flutter, React Native, Kotlin Multiplatform, Node.js, and Spring Boot. AI and Edge ML that runs on-device to cut per-request costs and keep user data private.

And cloud architecture consulting across AWS and Azure. I’ve spent years architecting production cloud systems — designing for cost, scale, and security, not just getting things to run. I’m both an AWS Certified Solutions Architect and an Azure Certified Solutions Architect, with deep hands-on delivery from serverless and CI/CD pipelines to full workload migrations.

If you’re scoping a build, stuck on a hard problem, or just want a second opinion before you commit, book a consultation. Let’s ship it right.

[Solved] – Fixing Dynamic linker error, dyld Library not loaded issue in Xcode

If you get the below error while building in Xcode

dyld[596]: Library not loaded: @rpath/SomeFramework.framework/Core
  Referenced from: /private/var/containers/Bundle/Application/ABBB12A-A11E-4824-9A8E-66296BEBC700/MyApp.app/Frameworks/SomeFramework.framework/SomeFramework
  Reason: tried: '/private/var/containers/Bundle/Application/ABBB512A-
A11E-4824-9A8E-66296BEBC700/MyApp.app/Frameworks/SomeFramework.framework/Core

it refers to issues with linking in Xcode. I have prepared the simple 8 ways by which this issue can be fixed easily

I have moved the solution to https://okchanges.com/devops/2022/05/19/solved-Fixing-Dynamic-linker-error-dyld-Library-not-loaded.html

Our new website – https://qa-gpt.com/.

[Solved] Key must be Base64 encoded with OpenSSH format and RSA type. Valid keys will start with ssh-rsa

I have moved the solution to error “Key must be Base64 encoded with OpenSSH format and RSA type. Valid keys will start with ssh-rsa” which you see in azure/microsoft tfs/git server to the below link

Solution Moved here

Checkout https://okchanges.com/ for more of my blog articles or my services

Checkout https://whichidiot.com, a free mobile number lookup service to detect legitimate business or scam/fraud

TensorFlow For Mobile Apps – Simple Tutorial

This is a simple tutorial for implementing machine learning with custom model in mobile apps. This tutorial consists of 3 parts.

Repos

Simple TensorFlow Model for computing y= 2x+1. There are 3 repos

  1. Tensorflow model – To Train and create the model
  2. TensorflowLite Model for Android. – Implementing model in Android
  3. CoreML model for iOS (using CoreML tools) – Implementing model in iOS

I could have used tensorflow lite for iOS. I implemented CoreML because, its easier with documentation and debugging. CoreML also supports on device machine learning. TFLite in iOS does not support on device machine learning.

I have used ‘Nadam’ optimizer with Mean absolute error regression loss. Feel free to play with different optimizer.

How to use

  1. Go to colab.google.com
  2. Open the jupyter notebook(ipynb) in this repo
  3. Click ‘Connect’ and wait till you get a free connection to google compute python backend
  4. Run the code

I have added comments in the jupyter notebook which are self explanatory.

When you successfully run all the code, you get the following items in files

  1. SampleModel.h5 – Tensor flow model which can be used later
  2. SampleTFLiteModel.tflite – TFLite Model for Android
  3. SampleMLModel.mlmodel – CoreML Model for iOS

Checkout https://okchanges.com/ for more of my blog articles or my services

Checkout https://whichidiot.com, a free mobile number lookup service to detect legitimate business or scam/fraud

Long press detection for Ionic/ Angular JS based apps

Detecting long press in ionic/ angular js apps can be tricky. You may have to use a third party plugin to detect long press gesture natively and pass them back or you may have. Ionic platform detects long press for the button types only.

<button on-hold="onHold()" class="button">Test</button>

But in some cases you may need to detect long press for other types too like <div> .

This gist may help in normal cases. But I found an issue with logic. Long press is triggered even when you touch and drag in certain cases where you have to scroll content.  I improved upon the current logic and upgraded to truly detect long presses and avoid false positives in Gist. I extended the logic by detecting time differences after touch start detection.

With my new directive you can have long press gesture detection on all html elements. Below is an example.

<div class=“someClass“ on-long-press = “itemOnLongPress(someObject)“></div>

My long press detection directive is available in Gist .

 

SiriKit Tutorial

Apple has introduced the much awaited SiriKit in iOS 10. But unforunately Siri support for your app is limited only if your app can serve requests on the following note.

  • Audio or video calling

  • Messaging

  • Payments

  • Searching photos

  • Workouts

  • Ride booking

 

For functional SiriKit integration you need to use Intents Extension (Intents Framework). and for branding/Customizing of Siri results you need IntentsUI Extension.

 

In your Xcode 8 beta, you can try adding Intents Extension from application extension templates.

 

To specify the intents that your app supports
  1. In Xcode, select the Info.plist file of your Intents extension.

  2. Expand the NSExtension and NSExtensionAttributes keys to view the IntentsSupported and IntentsRestrictedWhileLocked keys.

  3. In the IntentsSupported key, add String items for each intent you plan to support. Set the value of each item to the class name of the intent.

    This key is required. You can support all or some of the intents in a given domain, and your extension can support as many domains as you want. The value must contain all of the intent class that your extension supports.

  4. In the IntentsRestrictedWhileLocked key, add String items for any intents that you support only while the user’s device is unlocked. Set the value of each item to the class name of the intent.

    This key is optional. The value contains the subset of intent classes for which you require an unlocked device. You might include an intent in this list if handling the intent involves accessing protected files on disk or manipulating sensitive user data.

Implementing the behavior of your extension involves the following tasks:

  • Define handler classes for each intent that you support. You can define one handler class for each intent or use a single handler class for multiple intents. The use of protocols makes it easy to turn any object into a handler object for intents. For information on how to implement your handlers, see Resolving and Handling Intents.

  • Add the custom source files that you need to perform the tasks for any supported intents. Your extension must be capable of performing the tasks associated with any intents. For example, the handlers for a ride booking service must be able to book rides and get information about rides using that service. Add whatever source files to your extension project that you need to make that happen; see Structuring Your App’s Services.

  • Update the default INExtension class that Xcode provided. Modify the handlerForIntent: method of the Xcode-provided INExtension subclass to create and return your custom handler objects. For information on how to implement this method, see INIntentHandlerProviding Protocol Reference.

  • Define any custom vocabulary that your app uses. Apps that use words or phrases in specific ways can define a custom vocabulary file to help Siri understand that custom usage. For information on how to provide Siri with your app’s custom vocabulary, see Specifying Custom Vocabulary.

For a list of available intents and the associated classes and protocols you implement for each one, see Intents Domains.

Requesting Siri Authorization in Your iOS App

Before your Intents extension can be used and before any user-specific vocabulary can be registered, your iOS app must request authorization to use Siri. To request authorization, do the following:

  • Include the NSSiriUsageDescription key in your app’s Info.plist file. The value for this key is a string describing what data your app sends to Siri when processing intents. For example, a workout app might set the value to the string “Workout information will be sent to Siri.”

  • Call the requestSiriAuthorization: class method of INPreferences at some point during your app’s execution.

The first time that your iOS app calls the requestSiriAuthorization: method, the system displays an alert that prompts the user to authorize your app. The alert includes the usage description string you provided in the NSSiriUsageDescription key of your app’s Info.plist file. The user can approve or deny your app’s request for authorization and can change your app’s authorization status later in the Settings app. The system remembers your app’s authorization status so that subsequent calls to the requestSiriAuthorization: method do not prompt the user again.

Structuring Your App’s Services

Your Intents extension is an agent that acts on behalf of your app and should be able to perform the same services that your app does. Because your iOS app and Intents extension perform many of the same tasks, consider the following:

  • Use a private shared framework to store the code for your core services. Link the framework into both your iOS app and your Intents extension. A shared framework minimizes the size of both executables and ensures that both are using the same code to interact with your services.

  • Use a shared container to store common resources. If your services use images or data files that live outside the app bundle, put those resources into a shared container. Enable shared container support in the Capabilities tab of each target.

Testing Your Extension

To test your Intents extension, you must run it on a device. Xcode provides support for launching your Intents extension directly from your Xcode project and for debugging it while it runs on the device.

To run and debug your Intents extension on a device
  1. Set the active scheme to the one for your Intents extension.

    When you add an Intents extension to your project, Xcode automatically creates a scheme for running that extension.

  2. Configure the scheme to run on a connected device.

    You cannot debug your Intents extension in the simulator.

  3. Select Product > Run to launch your extension on the device.

  4. When prompted by Xcode, select Siri as the app to run.

    Xcode builds your app and extension, installs them on the device, and launches Siri.

When installing your extension for the first time, Siri may not immediately recognize your app extension. You may need to wait several minutes before you can issue any relevant commands. Similarly, when updating your Info.plist file, you may need to wait several minutes before Siri recognizes the changes.

Custom URL Scheme and AppLinking/ Universal Linking in Cordova / Hybrid world

Universal Links were introduced in iOS 8 and App Links were introduced in Android Marshmallow (6.0). In general they both linked tailor made http links to their respective apps thereby more intuitive and secure. Universal links and App links are a sound proof  replacement of 5 year old “Custom URL Schemes”.

In order to support lower versions, you still need to use Custom URL schemes. Down below is a simple tutorial to have both Custom URL scheme and Applinks/Universal linking without breaking much sweat

Pre -requisite

  1. You should know iOS Profile management – Creating App IDs, Provisioning profiles etc
  2. You should know cordova and a hybrid framework like ionic
  3. You should know some basic Xcode/ Android studio stuff
  4. You should hold root access to a public https domain where your server is hosted. In short you should be in friendly terms with your server developer😜

General Logic for implementation would be

  1. Custom URL Scheme implementation
    1. You need to install this Custom URL Plugin
  2. Setup Universal Linking in iOS

    1. Implement Universal Linking in iOS with this tutorial
    2. Reuse custom URL scheme by adding some code
  3. Setup Universal Linking in Android
    1. Implement App Linking in Android with this tutorial
    2. Reuse custom URL scheme by adding some code

Custom URL Scheme implementation

  1. You need to install this Custom URL Scheme Plugin . Follow the steps for installation.
  2. With this plugin installed. You need to add the following function in your javascript
    function handleOpenURL(url) {
    // Do string comparison and handle page loading
      console.log("received url: " + url);
    
    }
    
    
  3.  If you are using ionic/ angular JS based hybrid framework then you make use of external_load for handling page loading and redirection
var handleOpenURL = function(url) {
    window.localStorage.setItem("external_load", url);
};

 

 

Setup Universal Linking in iOS

 

Implement Universal Linking in iOS with this tutorial  and you need to insert this code in AppDelegate.m .

– (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler{
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSURL *url = userActivity.webpageURL;
NSLog(@”URL %@”,url.absoluteString);
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
// do something with the URL
}

return true;

}

Setup Universal Linking in Android

Implement App Linking in Android with this tutorial.  Next open AndroidManifest.xml in Android studio and add/replace the following code in Main activity’s intent filter.

<activity 
android:configChanges="orientation|keyboardHidden|keyboard|locale" 
android:label="@string/activity_name" android:launchMode="singleTop" 
android:name=".MainActivity"
 android:theme="@android:style/Theme.DeviceDefault.NoActionBar" 
android:windowSoftInputMode="adjustResize">

<intent-filter android:label="@string/launcher_name">
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter>
    <data android:scheme="yourapp" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

 <intent-filter android:autoVerify="true">
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT" />
 <category android:name="android.intent.category.BROWSABLE" />
 <data android:scheme="http" android:host="yourdomain" />
 <data android:scheme="https" android:host="yourdomain" />
 </intent-filter>
</activity>

 

Thats all folks. Now the app can handle both Custom URL scheme and AppLinking/Universal Linking in Android and iOS. Post comments if you need clarification.

Absolute/Relative File URL issues in iOS

Do you have issues in writing to and reading from files in iOS? Is it failing with NSPosixErrorDomain error codes? We will start with diagnosis of common cases and move to advanced cases

  1. As always check if you have valid NSData to write
  2. Check if you have a valid URL path
  3. Check if your subdirectories exist

If nothing works above you need to use a file writing API which can throw error, like the one below

public func writeToFile(path: String, options writeOptionsMask: NSDataWritingOptions) throws

instead of something like this

public func writeToFile(path: String, atomically useAuxiliaryFile: Bool) -> Bool

to catch an error. 95% of the error cases falls within the above said.

There is one more case that is rarely discussed. Hard to diagnose too – the case of handling Absolute and Relative URLs. Lets discuss that below.

Lets assume if you have a function to write image to a path as shown below. At the end of file write we capture both full file path and relative file path to read later.

Screen Shot 2016-05-17 at 5.42.48 PM

Here we retrieve the image from full file path. This one will work but only for the current active session. The image path will look like this

If your print the path it will look something like this

/var/mobile/Containers/Data/Application/A3955D86-3C02-48F9-AB5C-3582D8383F6E/Documents/Folder/image.png

Screen Shot 2016-05-17 at 5.46.04 PM

If you try to access the file within the same session, it would still work. But if you try to access the image in a different session you would get a “File not found” error.

The path of image in previous session, had you stored it would be

/var/mobile/Containers/Data/Application/A3955D86-3C02-48F9-AB5C-3582D8383F6E/Documents/Folder/image.png

In a newer session the image would be moved by  iOS to

/var/mobile/Containers/Data/Application/937FEDCD-1B90-4F38-9C3D-F86627BE3D3C/Documents/Folder/image.png

Note the change in folder path. Its evident that folder signature is generated dynamically by iOS. I believe its an excellent mechanism to safeguard data.

So back to our issue. Look at the next case. We retrieve relative file path and we construct absolute path by appending with documents directory.

 

Screen Shot 2016-05-17 at 5.46.12 PM

Relative path will be of the following format

/Folder/image.png

when you append with Documents directory first time, the path of image would be

/var/mobile/Containers/Data/Application/A3955D86-3C02-48F9-AB5C-3582D8383F6E/Documents/Folder/image.png

And when you reconstruct the image path in a different session it would be

/var/mobile/Containers/Data/Application/937FEDCD-1B90-4F38-9C3D-F86627BE3D3C/Documents/Folder/image.png

You can validate by accessing the file path to confirm file existence.

Moral of the story : Use relative file URLs to handle files. Always construct absolute paths dynamically