My Diary.
to Share my Life Events

Solve missing sidebar in Mac finder

NewImage

If your favourite sideback in Mac finder is missing. Use the following command in the terminal to get it back.

 

NewImage

cd ~/Library/Preferences && sudo find com.apple.finder.plist* -exec rm {} \; && killall Finder

But you need to build back your favourite sidebar.

Admin Admin Author

None of the valid provisioning profiles allowed the specified capabilities Features: inAppPurchase

NewImage

 

 

If you have working application in AppStore with inApp Purchases and your certificate and provision profile was expired. You can try to press "Fix Issue Automatically” in Xcode general setting. BUt if you get the following error message.

"An App ID with identifier 'com.mycompany.myproj' is not available. Please enter a different string."

or

"Code Sign error: No matching provisioning profiles found: None of the valid provisioning profiles allowed the specified capabilities: Features: inAppPurchase.."

The solution of this problem is to  o manually add the provision profile that you have created in https://developer.apple.com/account/ios/certificate/

 

NewImage

Admin Admin Author

How to test for in App Purchase Apps using sandbox tester account

NewImage

 

Goto to iTunes Connect. And Click the User and Roles Icon.

 

NewImage

Click the Sandbox Testers tab bar.

NewImage

 

Add a new Sandbox Tester Account. Create a new tester testing by using different email than your main apple account and click Save button.

 

 

NewImage

Go to your iPhone and iPad device and select the settings icon, go to Tunes & App Store and select your Apple ID and Click the Sign Out Button.

Now go to your test Apps, and when its prompt to enter your Username and Password, use the new sandbox account.

 

 

 

 

Admin Admin Author

How to make app speak in IOS

NewImage

 

We will use same AVSpeechSynthesizer class that availabe on iPhone and iPad. It is very easy to make app speak on iOS. You can make the app to say what ever you want. It is based on siri text to speech technology.  If you want to make your app speak, just add the following code in the ViewController.swift files.

 

//

//  ViewController.swift

//  Text2Speech

//

//  Created by Hafiz on 06/10/2016.

//  Copyright © 2016 HafizRich. All rights reserved.

//

 

import UIKit

import AVFoundation

class ViewController: UIViewController {

 

        override func viewDidLoad() {

        super.viewDidLoad()

            let utterance = AVSpeechUtterance(string: "Hello world")

            utterance.voice = AVSpeechSynthesisVoice(language: "en-GB")

            utterance.rate = 0.1

            

            let synthesizer = AVSpeechSynthesizer()

            synthesizer.speakUtterance(utterance)

    }

 

    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

        // Dispose of any resources that can be recreated.

    }

 

 

}

 

 

Admin Admin Author

How to add Admob Firebase in Swift Xcode project

Today we will learn how to add Admob in Swift project. Admob is mobile monetization provider by Google.

1. First we need to create a new project in Xcode.  First you need to sign up as admob publisher. Then click the Monetise tab and click the Monetise New App Button.
NewImage

2. Then click add your app manually, you need to enter the app name, select platform as iOS and click add App.
NewImage
3. Then we will add a new banner and give the banner a new name.
NewImage
4. It is a good idea to link a new firebase Analytics tool to help you learn more about your user.
NewImage
5. You must remember this iOS bundle that you enter and match it with your Swift Xcode project later.
NewImage
6. Next you need to download the Google Mobile Ads SDK. AdMob is now part of Firebase.
The Mobile Ads SDK for iOS utilizes Apple's advertising identifier (IDFA). The SDK uses IDFA under the guidelines laid out in the iOS developer program license agreement. You must ensure you are in compliance with the iOS developer program license agreement policies governing the use of this identifier.NewImage

7.You also need to download the GoogleService-info.plist in step 3 so that you can use Admob properly with Xcode.

NewImage
NewImage
8. For our tutorial, Click Single View Application. Its also work with Tabbed Applciation and Game project.
NewImage

9. Setup a product name and organisation indentifier according to your need. Set language as swift and device as universal. Select Use Core Data, Include Unit Test and Include UI Tests. Click next to continue.
NewImage

10. Make sure you remember the Bundle Indentifer as it must match the App id in the  http://apps.admob.com

NewImage
11. Drag and Drop the GoogleMobileAds.framework into your Xocode project. If you have not download the SDK yet, follow step 6.
 NewImage
12. Select the checkbox the copy items if needed, create folder references and Add to targets or the Admob will not works. Refer to the image above.

NewImage
13. Drag and Drop the GoogleService-info.plist that you have downloaded in step 7 into Xcode Project
NewImage

14. Make sure the GoogleService-info.plist is named without any number append to it just like picture above.
NewImage
15. Select the Main.storyboard file and drag and drop the UIView component into it.

NewImage

16. In the custom Class, we set the class name as GADBannerView. This GADBannerView will display our admob ads.

NewImage

17. In the inspector size view, set the width as 320 and height 50. This is a standard admob banner size.
NewImage
18. Drag UIView to the bottom of the screen and left click and drag until the menu pop up like picture above select width.
NewImage
19. Left click and drag down on UIview and select height when the pop up menu appear.
NewImage
20. Right click on the UIview and drag and drop it into the View component. Make sure you select the Vertical Spacing to Buttom Layout Guide and Centre Horizontally in Container.

NewImage

21. Select the view Controller and click the NewImage icon to switch to show the editor.

NewImage

22. Next add import GoogleMobileAds under the import UIKit
NewImage
23. Rename the view to BannerView

NewImage
24. Click click on the BannerView and right click and drop it into edtior until the pop out (refer to image above)
NewImage
25. Name it to any name you want (in our tutorial we will choose BannerView) and click connect button.     @IBOutlet var BannerView: GADBannerView! code should appear in the code editor below the class ViewController.
NewImage
26. Add GADBannerViewDelegate superclass in the ViewController class.
NewImage


27. Add the following code
          let request = GADRequest()
            request.testDevices=[kGADSimulatorID]
            BannerView.delegate=self
            BannerView.adUnitID="ca-app-pub-YOURID/APPID"
            BannerView.rootViewController=self
            BannerView.loadRequest(request)
    }


NewImage
28. Now you can test and run the code in the simulator.

Download the project at github https://github.com/hafizmus/admobfirebaseswift
Admin Admin Author

Create XML sitemap for blogger

NewImage

The XML Sitemap file is like a map folder of all web pages and html that exist on your website or blog. Search engines robot like Google and Yahoo can use these sitemap files to discover pages on your site that the regular search bots may have otherwise missed during regular crawling. The problem with default blogger XML sitemap will only display the last 26 article of your blog.  We are going to build sitemap generator for blogger soon for regular blogspot and self hosted blogger.

 

NewImage

Visit the XML generator for blogger here

 

Next step, login to blogspot, goto search preferences -> crawlers and indexing section -> Custom Robot.txt and paste the generated tag.

 

 NewImage

 

 

 

Admin Admin Author

How to create hotspot on your mac book and share your wifi via bluetooh PAN.

Your Mac Book air can function as a wireless hotspot, allowing you to  share its Internet connection with other devices such as your iPhone or Ipad.

NewImage

 

It is easy to share your connection from wifi to other computer or phone using IPhone USB, Thunderbolt bridge and Bluetooth PAN. What you need to do is click System Preferences in the menu and click sharing icon. 

 

NewImage

 

If you want to share you macbook air wifi to your iphone using Bluetooth, make sure you enable bluetooth PAN first.

NewImage

Then go the Sharing dialog and check the Internet Sharing checkbox and select the Bluetooh PAN. Make sure you select the “Internet Sharing” option in the list.  

Note that can’t both be connected to a Wi-Fi network and host a hotspot network at the same time. But you can always use Iphone USB or Bluetooth PAN to share your Internet connection.

 

If you can pair your bluetooh connection. Click here https://discussions.apple.com/thread/2645960?tstart=0 for solutions.

Admin Admin Author

How to disable night shift iOS in 3 easy step

 

NewImage

 

In the iOS 9.3 update, Apple introduce Night Shift – a feature that shifts the colors of the Retina display to the warmer end of the spectrum based on time and location. Your screen will be a bit dimmer at night. Some people don’t like this warmer colour as its make it difficult to read. Here is what you need to do to disable the night shift features. 

 

First Go to Setting icon.

NewImage

 

1. Click the Display & Brightness

 

 

NewImage

 

2. Click Night Shift menu.

 

NewImage

 

3. Click scheduled toggle to disable the night shift or you can change the colour temperature according to your need.

 

 

 

 

 

 

Admin Admin Author

How to recover GB of disk space from Xcode 7.3

 

NewImage

 

Xcode is huge monster. There are 3 important place where you can save a lot of disk space on your Mac Book Air or Mac book Pro.

1) Archives
Just go to ~/Library/Developer/Xcode/Archives and delete it there. It is just an archive which contains additional data like debug information. You can save ton of GB by deleting this folder.

 

xcodefile

 

2) Old Device Information
Every time you update your iOS, Xcode will make a copy of device infomation. You can safely remove old  iOS device infomation at ~/Library/Developer/Xcode/iOS DeviceSupport/ which is about ~1GB per folder

 

 

3) Simulator-Apps
You can also clean up big old simulator apps at ~/Library/Application Support/iPhone Simulator.

Admin Admin Author