Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8905799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:29:07+00:00 2026-06-15T02:29:07+00:00

Problem Description I have a function StdString ShowLockScreen() in this function I call activateViewController

  • 0

Problem Description

I have a function StdString ShowLockScreen() in this function I call activateViewController function which shows some UI where user must enter PIN, just after calling activateViewController function I want to lock all processes until user will enter his PIN and press OK button on opened UI. Below you can see code which I try

Source code in iOS

StdString ShowLockScreen() 
{
    // Create a lock.
    NSLock* theLock = [[NSLock alloc] init];
    // Create a UI in which user must enter his PIN.
    PinLockController* controller = [[PinLockController alloc] initWithStyle:PinLockTypeSet];
    // Set delegate. 
    controller.delegate = m_Context;

    // !!! Here I show a UI and just after that I lock my lock in order code stop executing there.
    [controller activateViewController:nil];

    @synchronized(theLock) {
        [theLock lock];
    }

    NSLog(@"User in UI unlock the lock");
}

I want that my code stops then I call [theLock lock]; and after I will call [theLock unlock]; from my UI and code will continue executing. But it doesn’t work in my case.

Source code in Android

I have write similar application in Android and here is code. I want to write same in iOS but I can;t find solution

Intent intent = new Intent(mCtx, SoftPinActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

SharedObject lock = new SharedObject("");
int lockId = SharedObject.acquireLockId(lock);
Logger.i(TAG, "lockId = " + lockId);
intent.putExtra(SharedObject.LOCK_ID, lockId);
intent.putExtra(SoftPinActivity.UI_ID, style);

synchronized (lock) {
   mCtx.startActivity(intent);
   try {
          Logger.i(TAG, "lock.wait()...");
          lock.wait();
   } catch (InterruptedException e) {
          e.printStackTrace();
          Logger.i(TAG, "InterruptedException");
   }
}
Logger.i(TAG, "lock.wait()...done");
SharedObject.releaseLockId(lockId);

String pin = lock.object();

Researches

I think I must use

NSCondition* condLock = [[NSCondition alloc] init];
[condLock wait];

and

[condLock signal];

but how to use this in my code ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:29:09+00:00Added an answer on June 15, 2026 at 2:29 am

    Okay I found solution to this issue, below you can see implemented function and line by line description.

    StdString ShowLockScreen() 
    {
        // Create NSCondition lock object.
        NSCondition* conditionLock = [[NSCondition alloc] init];
    
        // Here I create my UI which must ask user to enter PIN.
        PinLockController* controller = [[PinLockController alloc] initWithStyle:PinLockTypeSet];
        controller.delegate = m_Context;
    
        // Here I lock the thread but not main thread (this is very important) I start
        // ShowLockScreen function in new thread and lock it.
        [conditionLock lock];
    
        dispatch_sync(dispatch_get_main_queue(), ^{
            // I call function which shows my UI in main thread as UI can be shown 
            // only in MAIN THREAD. (This is important too.)
            [controller ShowLockController:conditionLock];
        });
    
        // Then I set lock to wait, how you can see I pass conditionLock as an 
        // argument to ShowLockController function in that function when user
        // enter his PIN and press okay button I call [conditionLock signal];
        // and my code code here after wait and continue executing.
        [conditionLock wait];
    
        NSLog(@"Come here then I call [conditionLock signal]!!!")
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my homework, but please read my problem description first. I have to
I have a problem. I have getAllJobsControllerUrl() function which return url with specific parameters:
I have this function which cuts a string into a number of characters without
I have this function (includes description): def deep_list(x): fully copies trees of tuples to
i have recrusive function which works fine. The problem is it gives stackoverflow error
Here's a description of my problem: i have an array containing ids for some
Description: I have a problem regarding DataGridView . I need to show a Client_Name
I have a problem with the query below in postgres SELECT u.username,l.description,l.ip,SUBSTRING(l.createdate,0,11) as createdate,l.action
I have a homework problem here I've been working on; here is the description:
I have a product table where the description column is fulltext indexed. The problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.