Monday, September 10, 2018

Does Android studio show all class names in Red?

Even though the project builds successfully, all of the class names if shows up in red, just do

File -> Invalidate Cache / Restart

Pretty useful and avoids the annoying look of red!


Firebase GoogleServices-Info.plist how to add?

Many times have gotten into the crash scenario due to the file was not added properly. Below is the common error.

*** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure]; (FirebaseApp.configure() in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'

To avoid, it add like below 


How to load view View controller from storyboard inside an iOS framework?

        let podBundle = Bundle(for: FrameworkViewController.self)
        let storyboard = UIStoryboard(name: "Storyboard", bundle: podBundle)
        let vc = storyboard.instantiateInitialViewController()!
        parentController.present(vc, animated: true, completion: nil)


important point is to get the bundle object for the bundle which is holding the storyboard and the class essentially. 

What are the libraries usually required for VoIP SDK integration?


Once you've downloaded and unpacked the framework, navigate to your Xcode project's General settings page. Drag and drop VoIPSDK.framework onto the Embedded Binaries section. Ensure that "Copy items if needed" is checked and press Finish. This will add VoIPSDK.framework to both the Embedded Binaries and Linked Frameworks and Libraries sections.

Next, you will need to open your project's Linked Frameworks and Libraries configuration. You should see the VoIPSDK.framework there already. Add the following frameworks to that list:

AudioToolbox.framework
VideoToolbox.framework
AVFoundation.framework
CoreTelephony.framework
GLKit.framework
CoreMedia.framework
SystemConfiguration.framework
libc++.tbd
In your Build Settings, you will also need to modify "Other Linker Flags" to include -ObjC.

Before distributing your app to the  App Store, you will need to strip the simulator binaries from the embedded framework. Navigate to your target's Build Phases screen and create a new "Run Script Phase". Ensure that this new run script phase is after the Embed Frameworks phase. Paste the following command in the script text field:

/bin/bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/VoIPSDK.framework/remove_archs"

Background Modes

To allow a connection to a Room to be persisted while an application is running in the background, you must select the Audio, AirPlay, and Picture in Picture background mode from the Capabilities project settings page.

How to install same pod in multiple target?

Solution is simple, and below is possible because pod file is just a ruby file.

platform :ios, '9.0'

use_frameworks!

# My other pods

def common_pods
    pod 'Pod1', '0.5.0'
    pod 'Pod2', '2.0.0-rc.1'
end

target 'MyTarget1' do
    common_pods
end

target 'MyTarget2' do
    common_pods
end


references:
https://www.natashatherobot.com/cocoapods-installing-same-pod-multiple-targets/

What is an iOS bundle?

A Bundle (or NSBundle with Objective-C) is just a collection of resources. When you create an iOS application you start out with a main bundle (the contents of the .app file). When you create a framework Xcode stores the resources for that framework in a separate bundle (the file AmazingFramework.framework in this case).

To get the main bundle for an application:

// Swift
let mainBundle = Bundle.main

// Objective-C
NSBundle *mainBundle = [NSBundle mainBundle];
You can get the bundle that contains a class using init(for aClass: AnyClass). For the framework bundle that contains our AmazingView:

let amazingBundle = Bundle(for: AmazingView.self)

references:
https://useyourloaf.com/blog/loading-resources-from-a-framework/

Thursday, August 2, 2018

VoIP : Noise cancellation in iOS

How noise cancellation works is that, when there is any background noise, the noise cancellation technology does not attempt to eliminate it, instead it counters it by sending another stream of sound, so that the ear will hear but brain won’t be able to process it to make it audible.

Since the sound and the “counter sound” are still hitting your eardrum, this can result in an odd sensation. Your ear is processing the sound, but your brain isn’t registering it. Since the inner ear controls balance, this will produce a dizzying effect in some people.”

Launch your Settings app with a tap, then tap the General button. Next, find the Accessibility tab and tap there. Swipe down to the Hearing section to find the Phone Noise Cancellation toggle. Tap on the switch to the right to set it Off.

In iPhone this can be turned off following the below settings



 

references: