SmartSVN – FileMerge as External Diff Tool

SmartSVN Preferences -> File Compare -> Add

File Pattern : *
External Diff Tool:
Command: /Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge
Arguments: -left ${leftFile} -right ${rightFile}

Electron Main Window Communicate with Tray

MainRenderer.js

ipcMain.on('main:progress:details', (event, value) => {
if (trayWindow && trayWindow.isVisible()) {
trayWindow.webContents.send('tray:progress:details', value);
}
});

TrayRenderer.js

ipc.on('tray:progress:details', (event, title, value) => {
// show to user
});

For more details, check the blog https://medium.com/@kahlil/how-to-communicate-between-two-electron-windows-166fdbcdc469

Debug React Native Source Code with Breakpoints

 

  1. Install React Native Debugger tool
    • brew update && brew cask install react-native-debugger
    • brew cask reinstall react-native-debugger
  2. Quit Google Chrome if it already running.
  3. Launch the React Native Debugger app from Applications folder.
  4. Activate iOS simulator and Run command+d using keyboard. In the debug menu select “Debug JS Remotely” option.
  5. Go to React Native Debugger. Select ‘Toggle Developer Tools’ sub menu item from ‘View’ menu.
  6. Select Sources tab
  7. In the left side menu, expand RNDebuggerWorker.js and expand sub option localhost:****. You will see the project root folder.
  8. Select a .js file and add break point. Break point will get activated when the respective line is executed.
  9. You can see the console logs in the console area at the bottom.

React Native – “Unable to resolve module”

Do the following steps to cleanup

  • Quit and launch Terminal
  • rm -rf iOS/build
  • npm cache verify
  • watchman watch-del-all
  • rm -rf node_modules
  • rm -rf /tmp/metro-bundler-cache-*
  • rm -rf /tmp/haste-map-react-native-packager-*
  • rm -rf $TMPDIR/react-*
  • rm -rf $TMPDIR/haste-*
  • rm -rf $TMPDIR/metro-*
  • npm cache clean
  • npm install && react-native link && react-native run-ios

 

iOS: Create Password Protected Zip File

Source: https://code.google.com/archive/p/ziparchive/

NSString *filePath = @"/Users//Desktop/uf/abc.txt";
NSString *zipFilePath = @"/Users//Desktop/uf/abc.zip";
NSString *content = @"Contents to be stored";

NSError *error = nil;
BOOL isFileCreated = [content writeToFile:filePath atomically:YES encoding:NSASCIIStringEncoding error:&error];

if (isFileCreated)
{
    ZipArchive *zipArchive = [[ZipArchive alloc] init];
    BOOL isZipFileCreated = [zipArchive CreateZipFile2:zipFilePath Password:@"domle"];

    if (isZipFileCreated)
    {
       BOOL isFileAddedToZip = [zipArchive addFileToZip:filePath newname:[filePath lastPathComponent]];
       NSLog(@"isFileAddedToZipFile %d", isFileAddedToZip);
       [zipArchive CloseZipFile2];
    }
}

 

 

CNContactPickerViewController – UISearchBar looks black in colour and entered text not visible

Setting search bar background colour will fix the issue, but cancel button is not visible in edit mode due to cancel button text is in white colour. The cancel button will be visible when we set the tint colour for label.

  • [[UISearchBar appearance] setBackgroundColor:[UIColor whiteColor]];
  • [[UILabel appearanceWhenContainedInInstancesOfClasses:@[UISearchBar.class]] setTintColor:[UIColor blueButtonColor]];

iOS CallKit Directory Extension Tips

Tips:

  1. The label text that you see will have the following format: Caller ID:  You can change the app name part of the label by changing app’s Bundle Name.
  2. You must provide a full country code and area code with the phone number.
  3. -reloadExtensionWithIdentifier:completionHandler:, which requests to have your app extension’s data reloaded by the system. Call this whenever you have new blocking or identification data to provide to the system.
  4. -getEnabledStatusForExtensionWithIdentifier:completionHandler:, which allows your app to query whether its extension has been enabled in Settings. Call this from within your app before requesting to reload data, and perhaps prompt the user to first enable your extension in Settings in order to begin loading data.
  5. The array of phone numbers must be a sorted list of int64’s. From smallest to largest. The list will be rejected with an “entries out of order” error otherwise.
  6. Store all the contacts to directory every time, because directory is getting recreated (loosing the previous contacts). Checked in iOS 11.
  7. Make sure the phone numbers are of type NSNumber instead of NSString.