Objective-C Programming

180

Solutions

207

Contributors

Objective-C is an object-oriented programming language that is a strict superset of C (any valid C code is equally valid Objective-C code), and it inherits its object-oriented capabilities from Smalltalk. All procedural syntax is identical to that of C, and all object-oriented syntax is an implementation of Smalltalk messaging. It is the main programming language used by Apple for OS-X and iOS and their respective APIs/ Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have an iPhone app almost completed using Objective-C and Xcode.  Now I find the text displayed in labels on a handful of View Controllers too small for certain people to see.  But I do not want to revert to a larger point size, since that reduces the screen area on the iPhone for people with good eyesight.  So I want that property to be made user configurable.

I want those labels all to get initialized from a single source, but some fields are defined in the  XIB file.

How can I do this?

Thanks.
0
I am new to this format (C++, C# developer)

What i the difference between assign versus retain?

@property (assign, nonatomic) BOOL added;
@property (retain, nonatomic) NSMutableArray* questions;

This is only required since we did not use ARC. True?

We decided not to use ARC so that we could support older versions of iOS.  But will that really provide us any advantage in the marketplace?

How hard is to to go back to using ARC?

Thanks.
0
Hi, I am trying to iterate through all the files in /Documents/Test/.  I know there is one file there, but the following loop is not being entered by program execution:

for (NSURL *url in enumerator) {



void ProcessFolder(void)
{
    NSFileManager *fileManager = [[NSFileManager alloc] init];
    NSURL *directoryURL = [[NSURL alloc]initFileURLWithPath:@"/Documents/Test" isDirectory:YES];
    NSArray *keys = [NSArray arrayWithObject:NSURLIsDirectoryKey];
   
    NSDirectoryEnumerator *enumerator = [fileManager
                                         enumeratorAtURL:directoryURL
                                         includingPropertiesForKeys:keys
                                         options:0
                                         errorHandler:^(NSURL *url, NSError *error) {
                                             // Handle the error.
                                             // Return YES if the enumeration should continue after the error.
                                             return YES;
                                         }];
   
    for (NSURL *url in enumerator) {
        NSError *error;
        NSNumber *isDirectory = nil;
        if (! [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:&error]) {
            // handle error
        }
        else if (! [isDirectory boolValue]) {
            // No error and it’s not a directory; do something with the file
        }
    }
}
0
I am making an iPhone app using using Xcode and Objective-C.  I will have a free version and a paid version.  They will be identical, but the free version can not create content, just read content and use it.

If this were a program using C# or C++ I would simply create a compiler directive, called whatever I wanted, such as FULL_VERSION.

Then I would use the correct syntax for
#if def FULL_VERSION
// add code which creates writeable content
#else
// add code which which explains the value of the upgrade and give access to IAP
// so the user can make an In-App Purchase of the upgrade
#endif

Is this still the way to solve this problem using Xcode and Objective-C.  (I may have not used the correct syntax, but that's not my question)
0
I want to have my developer write an algorithm which generates a secret key used to authenticate my iPhone app's data files.  But I want to change it before the program ships so I can keep the secret closely held.

When my Xcode developer gets latest source code, I want the program to work fully for him, but I do not want him to have the source code I modified to ensure my algorithm's secrecy.

In Windows, I'd write a DLL and make sure to add that DLL to source control.  But I would keep the source on some other platform.

How do I do this with Objective-C?

Thanks.
0
I am writing an iPhone app using Xcode/Objective-C and need to encrypt the files my app generates and then subsequently accesses.  What prebuilt library can I use to do this?

I would like it to be secure and "virtually impossible" to defeat without the key (and password?) that I intend to embed in the source code of my program.  The files will be text, image and audio.  Also, I plan to make an Android version of my app and want it to be able to access files created with my iPhone version.

So really, I need my choice of encryption software library to fit my cross platform strategy for my app.  

What can you suggest?  

I would prefer free, but would consider a paid version that had a "per developer" license, if that enabled me greater flexibility.

Hope to hear some great alternatives.

Thanks.
0
Like many apps, I'm attempting to build a Lite version of my app. I've gone to my lite target and added LITEVERSION to Preprocessor Macros under Debug, Distribution, Release. I've only added these definitions to the LITE target, NOT to the project, which didn't seem to help anyway. In my code where I want to execute functions specific to a target I have:
#ifdef LITEVERSION
    self.isLiteVersion = YES;
    NSLOG(@"This is for the lite version.");
#else
    self.isLiteVersion = NO;
    NSLOG(@"This is for the full version.");
#endif

Open in new window


Now all of that actually works just fine. The problem is in the #else section. Code sensing does work ... to an extent. When i started to type in the code "self.isLite..." in the ifdef section, I was able to use autocomplete to finish the code. However, in the else section, the autocomplete wasn't quite working. What I mean is it will bring up a list, but none of my local variables or classes are listed. It also doesn't matter which scheme I have selected, the else section doesn't autocomplete properly.

Like I said though, it does compile and the proper code is executed based on which scheme is selected. The autocomplete just isn't work properly.

Any ideas? Thanks a lot.
0
I need to find a way to use SMS to populate app data and update app data using local push after app data is updated.   Objective C examples, and or theory is also good.
0
Hi there;

I recently finished an ios app in objective-c, that i use standard controls but they don't look pro.

E.g. text fields are too simple looking.

Is there any 3rd party components that i can easily adapt to my app?

Regards.
0
I use SourceTree for my Objective-C and Xcode coding project.  It's worked great thus far.  But now when we try and merge code, we are have a crisis.  SourceTree only seems to allow the use of an external merge tool.  But does not seem to have one.

What can anyone suggest I do?  I am completely stuck.

Thank you for the help.
0
hello i want to make a IOS application where i can get a list of news from my news website and when the application get a new news from the server ! it will notify the person who user the iphone


ios application -- try to connect to web server - and fetch all news as list
and when new news appear in this application the user will notify if
we can send me a tutorial how i can do this i am a beginer in ios and if i can do it using php ?

or if we can tell me how i can do it?
0
I am new to iPhone app and Objective-C development.  What I need is that while the app is in the background, I need for it to show a value in the upper right corner, just like when a phone has updates ready.  Or, when I have emails, it show me mow many it has.

Is this a push notification which results in the counter being increased?

I do not plan to have a server, so is this even possible?

Thanks!
0
Is there any method in objective c or NS libraries to retrieve the version number of a framework library?
I want to do it from the code because I have a framework library and some apps that depend on this library.  I usually distribute the framework once but need to update the apps continuously; however, when someone has an issue with an app, I would like to make sure they are using the latest framework library so I want to update my program to display the framework version.
I know that one way would be to add a method to the framework but it's already distributed.
Another way would be to look in their /Library/Frameworks/myframework but I would prefer to use an existing method to get the framework version if possible.
0
Hello, Experts:

I'm loading an RTF file into a UIWebView. The RTF file loads up inside the UIWebView but it contains margins and I want to remove the margins and fit the text snugly within the view. I've set the margins in the RTF file to 0,0,0,0 and yet they still show up in the UIWebView. Can anyone tell me how to get these margins removed?

Thank you for your help.
0
First, I'm very new to programming and C++ so if I made a huge flaw in the code below, forgive me...it's possible I screwed up bigtime. I am trying to make a very, very basic program just so I can get started using xcode on my Mac instead of codeblocks on my pc to compile C++ programs

#include <iostream>
using namespace std;

int main(int argc, const char * argv[])
{
    int a,b,c,d,e,f,g;
    cout << "Enter 6 numbers: ";
    cin >> a >> b >> c >> d >> e >> f >> g;
    cout << a << b;
    return 0;
}

Open in new window


The above code outputs:
Enter 6 numbers: 

Open in new window


when I type in the 6 numbers ( as '1 2 3 4 5 6')and hit enter, the rest of the program does not run(the   cout << a << b;). I tried running the program from bash also but that too was not working. I'm feeling really dumb right now. Can someone tell me what I'm doing wrong?
0
Can anyone point me to a detailed tutorial on how to send iPhone push notifications from a asp.net server in Visual Basic?

All of them that I have found are for C#.
0
I have a new 2012 2 gen MBA. 256 SSD 8GB i7
 
Trying to install
 
port -d install gmake
 
Its been hanging on this section for 4 hours now...
 
checking how to run the C preprocessor... /usr/bin/clang -E
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... /usr/bin/grep -E
 
Would anyone now whats wrong??? Or better yet another method?

Btw.. Xcode is installed.
 
Thanks in advance..
 
Rich
0
Hello Experts,

Basically I am making an app that adds specific effects to my camera application.  I have built this from the ground up, and it seems something so simple has gotten me stumped.  apple documentation on this seems dated and I can not get it to work.  I am just looking for a way to push a button to capture a screenshot of the application and store it in the image picker.  I can not find the code or/and figure out how to do it.

Thanks in advance.
0
I read Apple's explanation of selectors, yet feel no closer to understanding it.  It seems like it is a delegate function (C# lingo) that can be attached to an object.  But please explain this code in English, not with links to articles.


- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {
  return [super methodSignatureForSelector:selector];
}

Thanks.
0
I am a former C++ developer and currently C#, but this Objective C is not at all clear to me.

I read up on it and it became less clear.  Please explain SEL and selector.

Thanks!


Feel free to use (or not use) my sample source code:

 
  //notify the delegate if steps are completed
-(BOOL)CheckStepsComplete{
    if (_priorStepCompleted == _numSteps) {
        if([self.delegate respondsToSelector:@selector(IsFinished)]){
            [self.delegate performSelector:@selector(IsFinished)];
        }

        return YES;
    }
    return NO;
}
0
would you please recommend me a set of tools, programming languages, set of library maps and charts that may be used to develop an entire Business intelligence system with graphs and maps functionallity?

Should I use adobe tools, java scripts, html5, etc. , which combination of tools and programming languages are recommended?

regards
0
I have an UIViewController(ViewController Class) with an imageView that loads and animation(startAnimation method) which is triggered when a UIButton is clicked. The button was inserted only for testing purposes. Then I have a UIView (TocaArea Class) that register touches on a context and depending on coordinates of the movement should trigger the animation on ViewController's startAnimation method.

I'm trying:

ViewController *anim = [[ViewController alloc]init];
        [anim startAnimation];

Open in new window


but even though I can build and run without errors it just doesn't triggers the animation. The UIButton triggers the animation and the gestures are being traced as it should.

Here are the files involved...

ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {    
    IBOutlet UIImageView *animation;
}
- (IBAction)startAnimation; // *** this triggers the method perfectly ***
@end

Open in new window


ViewController.m
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (IBAction)startAnimation {

    [animation setAnimationRepeatCount:1];
    animation.animationDuration = 3;
    [animation startAnimating];
}

- (void)viewDidLoad
{
    int n, numeral;
    NSMutableArray *imagenesArray = [[NSMutableArray alloc] init];
    for (n=2; n<91; n++) {
        numeral=n+10000;
        NSMutableString* imagenNombre= [NSMutableString stringWithFormat:@"Overweight 0%d.png", numeral];
        

Open in new window

0
Dear All:

Does any software available in market to develop apple app?

or we can only using xcode to develop apple app?

Thank you.
0
i need to develop application for macbookpro- or iphone

i guess i need to learn objective c , xcode blah..  

has anybody done the objective c online courses available in this website
http://www.lynda.com/ 
how is the experience

or if you know some other courses let me know

i want to learn it thoroughly from begining

i know how C, C++ works...

please guide... thanks a lot
0
How do I create my own properties, with my own Getter and Setter?

As a way to help enforce data encapsulation, I often use a public getter and a private setter. Is this possible with Objective-C?  Also, I read that hen using synthesize to create the Getters and Setters, the code is optimized for performance that the accessor methods will be efficient and will run safely with multiple threads, on multiple machines, with multiple cores.

Would I lose anything by creating my own and not using synthesize, in this case?

Thanks.
0

Objective-C Programming

180

Solutions

207

Contributors

Objective-C is an object-oriented programming language that is a strict superset of C (any valid C code is equally valid Objective-C code), and it inherits its object-oriented capabilities from Smalltalk. All procedural syntax is identical to that of C, and all object-oriented syntax is an implementation of Smalltalk messaging. It is the main programming language used by Apple for OS-X and iOS and their respective APIs/ Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods.

Top Experts In
Objective-C Programming
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!