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 7931705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:48:05+00:00 2026-06-03T20:48:05+00:00

I have a NavigationController -> UIViewController -> UIWebView I have a modal segue from

  • 0

I have a NavigationController -> UIViewController -> UIWebView

I have a modal segue from a tableViewController to the NavigationController.

whenever i perform this segue the Application crashes. I’ve written no code in the controller, just simply placed a uiwebview in the storyboard. If i remove the uiwebview the segue runs just fine.

The debugger stops at the singleton creation line in my singleton object “CoData.m”. And when i print a description of it it prints a uiwebview description, but it’s a custom class of type NSObject.

see here http://cl.ly/GZWJ
screenshot
and here http://cl.ly/Gaig
screenshot
What is happening?

This is where it crashes.

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"webView" sender:self];
}

EDIT**
abridged contents of CoData.m

import "CoData.h"

@implementation CoData

CWL_SYNTHESIZE_SINGLETON_FOR_CLASS(CoData);

@synthesize photoSessions = _photoSessions;
@synthesize userPhotos = _userPhotos;
@synthesize photoSet = _photoSet;
@synthesize user = _user;
@synthesize pushEnabled = _pushEnabled;
@synthesize showToast = _showToast;
@synthesize highQualityPhotos = _highQualityPhotos;
@synthesize photoQualityChanged = _photoQualityChanged;
@synthesize isRetina = _isRetina;
@synthesize campers = _campers;
@synthesize camperNames = _camperNames;
@synthesize infoStream = _infoStream;

-(NSCache *)photoSet
{
    if(!_photoSet){
        _photoSet = [[NSCache alloc] init];
    }
    return _photoSet;
}

-(NSDictionary *)user
{
    if(!_user){
        _user = [[NSDictionary alloc] init];
    }
    return _user;
}

-(BOOL)isRetina
{
    if(!_isRetina){
        _isRetina = ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2);
    }
    return _isRetina;
}

-(void)loadDataFromPlist
{


}

-(void)loginAPIUser
{

}

-(void)saveDataToPlist
{



}

@end

AND the CWL_SYNTHESIZE_SINGLETON_FOR_CLASS macro

//
//  CWLSynthesizeSingleton.h
//  CocoaWithLove
//
//  Created by Matt Gallagher on 2011/08/23.
//  Copyright (c) 2011 Matt Gallagher. All rights reserved.
//
//  Permission is given to use this source code file, free of charge, in any
//  project, commercial or otherwise, entirely at your risk, with the condition
//  that any redistribution (in part or whole) of source code must retain
//  this copyright and permission notice. Attribution in compiled projects is
//  appreciated but not required.
//

#import <objc/runtime.h>

#define CWL_DECLARE_SINGLETON_FOR_CLASS_WITH_ACCESSOR(classname, accessorMethodName) \
+ (classname *)accessorMethodName;

#if __has_feature(objc_arc)
    #define CWL_SYNTHESIZE_SINGLETON_RETAIN_METHODS
#else
    #define CWL_SYNTHESIZE_SINGLETON_RETAIN_METHODS \
    - (id)retain \
    { \
        return self; \
    } \
     \
    - (NSUInteger)retainCount \
    { \
        return NSUIntegerMax; \
    } \
     \
    - (oneway void)release \
    { \
    } \
     \
    - (id)autorelease \
    { \
        return self; \
    }
#endif

#define CWL_SYNTHESIZE_SINGLETON_FOR_CLASS_WITH_ACCESSOR(classname, accessorMethodName) \
 \
static classname *accessorMethodName##Instance = nil; \
 \
+ (classname *)accessorMethodName \
{ \
    @synchronized(self) \
    { \
        if (accessorMethodName##Instance == nil) \
        { \
            accessorMethodName##Instance = [super allocWithZone:NULL]; \
            accessorMethodName##Instance = [accessorMethodName##Instance init]; \
            method_exchangeImplementations(\
                class_getClassMethod([accessorMethodName##Instance class], @selector(accessorMethodName)),\
                class_getClassMethod([accessorMethodName##Instance class], @selector(cwl_lockless_##accessorMethodName)));\
            method_exchangeImplementations(\
                class_getInstanceMethod([accessorMethodName##Instance class], @selector(init)),\
                class_getInstanceMethod([accessorMethodName##Instance class], @selector(cwl_onlyInitOnce)));\
        } \
    } \
     \
    return accessorMethodName##Instance; \
} \
 \
+ (classname *)cwl_lockless_##accessorMethodName \
{ \
    return accessorMethodName##Instance; \
} \
\
+ (id)allocWithZone:(NSZone *)zone \
{ \
    return [self accessorMethodName]; \
} \
 \
- (id)copyWithZone:(NSZone *)zone \
{ \
    return self; \
} \
- (id)cwl_onlyInitOnce \
{ \
    return self;\
} \
 \
CWL_SYNTHESIZE_SINGLETON_RETAIN_METHODS

#define CWL_DECLARE_SINGLETON_FOR_CLASS(classname) CWL_DECLARE_SINGLETON_FOR_CLASS_WITH_ACCESSOR(classname, shared##classname)
#define CWL_SYNTHESIZE_SINGLETON_FOR_CLASS(classname) CWL_SYNTHESIZE_SINGLETON_FOR_CLASS_WITH_ACCESSOR(classname, shared##classname)
  • 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-03T20:48:07+00:00Added an answer on June 3, 2026 at 8:48 pm

    I looked at the code from http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html. well.. any reason why you can’t make singleton like this:

    +(MyClass *)singleton {
     static dispatch_once_t pred;
     static MyClass *shared = nil;
    
     dispatch_once(&pred, ^{
      shared = [[MyClass alloc] init];
     });
     return shared;
    }
    

    ?

    (src)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code in my application. [self.navigationController pushViewController:x animated:YES]; It will push a
I have this code to show a nib on click of row index UIViewController
I have in my only-ios5 application a navigationControllerDelegate: - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
I have an UIViewController into an navigationController.All I want is when I rotate from
I have the following code inside my UIViewController - [flipButton addTarget:self.navigationController.delegate action:@selector(changeModeAction:) forControlEvents:UIControlEventTouchUpInside]; As
I have an UIViewController, this controller is contained in a navigationController. I add an
I have a UIViewController ( AbcViewController ) with NavigationController . AbcViewController uses UIView (
I have 3 tabs and main navigation controller. I implements with code: UIViewController *monitorController
I have a TabController-based storyboard application with 4 different navigationController, one each tab. The
When MyView gets pushed on to the NavigationController, I have the following code public

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.