My Diary.
to Share my Life Events

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

Spell Checker for your smartphone



This spell check enables you to automatically correct spelling mistakes and make progress in the way you use English in writing. It delivers high quality auto suggestion very fast.

You can also use this spell checker to help your child with their homework.  Use this spell checker on the iPhone or iPad and work out how to spell words together.

Check and improve your spelling with Spell Checker. Write feedback and comment to make Spell Checker better.

*Required Internet Connection.

Coming soon on App Store and Amazon Store
  •  
Admin Admin Author

Protect your private camera photo with password photo



Lock  your camera photo on your iPhone with Password Photo. You can create your own personal photo safe list. Protect your private camera photo with passcode. You can use the application to  instantly capture any photo and protect it with passcode.




To lock pictures with Password Photo:
1) Setup setting and create new pin/password/passcode
2) Click plus button and take the picture
3) Now  your photo is safely in private list.
4) Now you have a safe private list photo that only you can view.


Coming Soon in Apple App Store
  •  
Admin Admin Author

Important update v10.11.6 for all OS X El Capitan users.


It is recommended for all users to download and update the OS X El Capitan v10.11.6 . This update will improves the stability, compatibility, and security of your Mac.

This update will resolves an issue that may prevent settings from being saved in accounts with parental controls enabled. It also resolves an issue that prevented some network devices, such as speakers and multifunction printers, from accessing SMB (Samba) share points.

For enterprise user, this update will improves startup time when connecting to a NetBoot server. It also  resolves an issue that may prevent startup from a NetBoot image created with an OS X v10.11.4 or OS X v10.11.5 installer.

It is advising for Mac users to update without delay.



Click on the Apple menu in the top left of your screen, then click About This Mac and choose the Software Update… button.

Admin Admin Author

How to delete Apple Apps and how to restore back in iOS 10

Apple iOS provide with preinstall application such as Calculator, Calendar , Compass , Mail and etc. The problem is that we don't use all the preinstall application. We cannot delete this preinstall application just like other apps prior to version 10.



Finally, we can remove the following 23 program from our iPhone or iPad just like other ordinary apps. 



  1. Calculator
  2. iCloud Drive
  3. Reminders
  4. Calendar
  5. iTunes Store
  6. Stocks
  7. Compass
  8. Mail
  9. Tips
  10. Contacts
  11. Maps
  12. Videos
  13. FaceTime
  14. Music
  15. Voice Memos
  16. Find My Friends
  17. News
  18. Watch app
  19. Home
  20. Notes
  21. Weather
  22. iBooks
  23. Podcasts

If you want to restore back the apps , just search it on App Store and Click Install.


Admin Admin Author