Working with files outside sandbox in Mac App (Accessing Security Scoped Resource)

I was developing an Mac application recently and came across the problem, which was quite interesting and i thought I can share my experience with you guys.

ok, let me directly get it stright. Recently I developed a Mac application for binary resigning, the functionality of the app is to take your ipa files and resign it with different certificates and provision profiles.

I developed this app successfully and tried to publish on app store using app Store connect. But when I try to push the app to App Store, Apple didn’t allow me to publish stating the reason “I am not using App Sandbox in my application”. Problem is my app needs to access resources outside of the sandbox, if I enable sandbox I won’t be able to access system directories like “~/Library/MobileDevice/’Provisioning Profiles”, which is essential for resigning. I did some research and found a solution, which is what I am about to explain below.

1) Enable sand box to your application under signing and capabilities

2) Update your entitlement files

All three items are mandatory. will allow to bookmark urls outside of the sandbox and will allow to read and write files outside of the sand box. using the combination of these three permissions we will be accessing files outside of the sand box.

  • First we will request read and write access for a specific directory
  • Then bookmark that directory and save it to local storage
  • Using startAccessingSecurityScopedResource function we will access system directories out side of sand box.

I wrote a simple code snippet for this solution.

Hope this will be helpful for you guys. Happy Coding ūüėĀ!!!

Connecting to MQTT in Swift & IOS

MQTT is a Message Queuing Telemetry Transport protocol, it is also called MQ Telemetry Transport. It is widely used in IOT (Internet of Things) to have a good connectivity between machine and machines (machine-to-machine M2M). It is designed to be  extremely lightweight to publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium. It is widely used in different areas like sensor communications, satellite broker link, dialup connection, healthcare providers and home automations. It is extremely ideal for Mobile Application because of its light weight, low power usage and minimised data packets.. For more information about MQTT visit Here.

I recently had a chance to implement it to one of the smart home application i developed, Therefore i thought of sharing my experience relate  to development. I have implemented this Protocol to my IOS application using Swift programming language.

Instruction to implement MQTT

One of the MQTT library available for IOS is called Moscapsule Visit Here

Lets get started……………..

Add these two lines to your podfile

run the command pod install. Then close and open your .workspace file

Now you have the Moscapules added to you project, open your AppDelegate.swift file and ad the following codes. You can see the comments inside the code itself

Thats it, Its very simple to connect, Since you have implemented this code in you AppDelegate, You can start the connection from anywhere inside the application by calling

You can check connection and subscribe to topics

The best way to send to your view controllers is buy Broadcasting the received message in onMessageCallback . Here is how i have done it.

You can add a broadcast receiver to you ViewController so that you can receive this broadcast

Thats it, Its very simple. Hope this helps for someone.

If you have any Question or suggestions please leave it below in the comments section. Happy Coding ūüôā . Enjoy MQTT


Smart Home (IOT) Project

Smart Home project done for leading internet service provider in Singapore and Malaysia. Smart Home is a one among many solutions they provide to their customer. Smart home is a complete security solution which supports almost all Z-Wave sensors, IOT devices and many more smart home appliances. This product is also expected to go live with the integration of leading market voice assistant such as Alexa and Google echo voice assistance.

Responsibilities: IOS Developer

  • Requirement analysis and design architecture for mobile programming.
  • Select suitable technology and library such as MQTT for the feasible solution.
  • Design, develop the mobile application IOS platform
  • Collaborate with designing team to ensure best user experience

 Key Areas: #MQTT, #Signal-R, #Swift,  #XML, #Rest, #Json, #pushNotifications, #cocoapods


IOS implementing SignalR using Objective-C

For the past few weeks i been doing some research on SignalR in Objective C and i found very few resources available on the internet for implementing signlR in Objective-C. Therefore i thought of writing this tutorial, hoping it will help some developers one day.

In this tutorial i will explain you, how to  get connected to SingalR hub using IOS and Objective-C. This tutorial is not for beginners.

All Information about SignalR Objective-C library can be found in this Link.

Lets setup the environment first. flow the steps below

  1. First of all create a new IOS Objective C project.
  2. Close the project and navigate to the project directory Using Terminal.
  3. Create a new podfile and save the following code. (make sure to change your project name instead of signalRObjective2)

This will install required libraries such as AFNetworking, SocketRocket and as well as SignalR-ObjC

4. Now run the below command  in your terminal

pod install

. This will install all the required libraries and create a file with extension .xcworkspace in side your project folder.

5. Open the file yourproject.xcworkspace file

Now we got over environment setup , lets do the real coding to get connected to SignalR HUB.

In order to do a signal R communication, You need to understand three main factors in Signal R, They are explained below

  1. get connected – You must get connected to signalR Hub and keep the connection with out closing it.
  2. Subscribe to hub method – You must create a subscription to your hub method at the time of connection.
  3. Invoke hun method – You must invoke a hub method, when ever you want to send some message to the Hub and also receive the response through the subscribed method as explained before.

Now lets see how to implement it.


As you can see from the above code, you will have to tell the signalR hub URl and also the hub proxy name to the signalR-ObjectiveC library.

Then you need to subscribe to the Hub method as shown in the above code. serviceStatus is the hub method and it will return the response to testMethod which is in the client side.

Invoking a method in signalR hub is very simple as shown in the above code. And if you code dont have any parameters. Your invoke will be like this as shown below

That it. Over all Code will be as shown below

That is. If you have any problems are suggestions please be free to comment below, I will be happy to respond them.Thank you. Happy Coding ūüôā