0
votes
1answer
7 views

CCHmac with kCCHmacAlgSHA1 has inconsistent output length

I'm working on an oauth library for iOS and about 10% to 15% of my requests are failing because the oauth_signature generated by my library is incorrect. I've traced the issue down to CCHmac() ...
-1
votes
0answers
36 views

How to guarantee to threads start two events simultaneously - playing a metronome while recording audio

We are looking to play an audio track (metronome click) at time intervals (bpm), while simultaneously recording an audio track (input). However currently, the two threads are not in perfect sync, and ...
3
votes
2answers
70 views

Pure C function calling Objective-C method?

Okay, I've read half a dozen threads on this subject, but none of the solutions appear to address exact needs. Question: How does a Pure C (.c) function call a method inside a Pure Objective-C (.m) ...
0
votes
0answers
55 views

How do I return a structure?

I have this code that does not works since user is always null. It's weird since if I debug before returning data it's ok but after returning data is always null. How can I fix this? I really ...
1
vote
2answers
65 views

converting/combining two uint8_t to int16_t in Objective-C

Suppose I have a buffer filled with uint8_t, like what I would get by executing uint8_t buffer[4]; [inputStream read:buffer maxLength:4]; Again, suppose I know that this buffer now contains two ...
0
votes
1answer
40 views

Objective C C++ if(cin >> variable) equivilant

I would like to have an if statement in objective C that says if the user properly enters the variable, do this. So for example if the variable is an integer and the user enters too many digits(over ...
1
vote
0answers
48 views

objective-c command line tool: return value to bash

I created command line tool (objective-c), and I need to store result of executing this tool in the variable, and pass it next to my different tool in bash script. The result of executing my tool is ...
0
votes
1answer
44 views

xcode file open native C

In an Xcode library project, I have a native .c file in which I need to open a text file from the app bundle or documents section. In Objective-C I can do: [[NSBundle mainBundle] ...
3
votes
3answers
114 views

#define: why uppercase?

When defining a macro (e.g. #define BALL). Why do people use uppercase letters? I can write something like #define ball. It is not in uppercase, but it works.
-6
votes
3answers
60 views

'&' What does it mean in this context

I have a question about the sign '&' in c, what does it mean in this line : ((st.st_mode & S_IRUSR)? putchar('w') : putchar('-')); Thanks in advance!
-7
votes
0answers
92 views

Why Object Oriented language invented [closed]

I'm learning java, Although procedural language is already present, why was object oriented language is invented, and what is advantage of object oriented language over procedural language.
0
votes
1answer
56 views

Memory leak in c code

I wrote this method using some non objective c code and instruments is telling me there is a leak. Not only that, but the free(char*) crashes... Any help would be appreciated. Thanks NSArray *keys ...
-1
votes
1answer
33 views

Combinations of n elements choosing r elements without repetition (Objective-c) [closed]

I have an array of objects (n). I want to output an array of unique objects by selecting (r) elements at a time. For example: n = 600, r = 10 How can we get an array of all possible unique ...
0
votes
1answer
65 views

SQLite C function in iOS application results in EXC_BAD_ACCESS

In an iOS application, I am trying to strip diacritics from a SQLite field in a table with 1 million rows. EDIT: The original answer I referenced has been updated by its author to reflect the ...
-1
votes
2answers
56 views

A weird return statement in C / Objective C [duplicate]

everyone, I am new to C / Objective-C and I am doing some exercise in Xcode. Actually it was lecture two from Stanford iTunes.U CS 193 iOS course fall 2013, if somebody's familiar with... The ...
-7
votes
0answers
63 views

Obfuscate a particular library function call so that it's not detectable in the binary [closed]

I need to use a particular API in my application. Now, how would I hide such a function from an automated scanning tool run on the binary? I need to call C functions declared like this: extern void ...
-1
votes
0answers
22 views

Vote: Which way do you prefer for helper method or etc. Objective-C Class Method vs C function and Why? [closed]

I want to know when you want to create a helper method or some kind of similar methods. Which way you guys use for the helper method. Class Method or C Function and why do you do that. This question ...
0
votes
0answers
43 views

Obj-C Reading CSV File with fscanf or equivalent

So I need to read a CSV file with minimal (or reasonably close to minimal) expenditure of memory using Objective-C. Right now I do it approximately like this: NSData *data = [NSData ...
1
vote
1answer
39 views

Can't create instance from my Objective-C class in C function

i am writing Objective-C with C functions in the same .m file, now i want to create instance in the C section from my Objective-C class. i can access some NSString, NSData and other Objective-C ...
2
votes
4answers
65 views

How to call Objective-C “self” from C method [duplicate]

I have Objective-C class in my iOS project that implements Objective-C and C code in the same class. I changed the extension to .mm and this part goes well. Now I want to set a C method that will call ...
1
vote
1answer
48 views

how to establish a p2p connection between the iphone and the simulator

I want to stream data between two peers. so i thought i'll start with just trying to send a simple string message between the two (or even just check if i can establish a connection between the two). ...
0
votes
1answer
59 views

Accessing a class ivar from a C function

I have a C function in a class (yes, has to be in C) and I need to access an ivar from that class. The ivar in question is a NSMutableDictionary. From what I understand, C functions don't have direct ...
0
votes
2answers
42 views

Creating Constructors with JavascriptCore

When using the JavascriptCore API, I'm not sure how to create new instances of Objective-C objects from Javascript via the new syntax (ex. var x = new MyAwesomeClass()). It seems like the constructor ...
0
votes
1answer
38 views

Objective C wrapper for C library: wrapping calls that return Obj-C objects

I'm trying to wrap a C library in Objective C so that I can let ARC handle the creation and destruction of the C objects. Here's my problem... How do I wrap C library functions that return a C object, ...
0
votes
1answer
65 views

block as parameter or return value for C function

I have a property like this on a class: @property (nonatomic, strong) void (^ifSuccess)(MyClass *myObject); Now I need to do this inside a C function: if (self.ifSuccess) { ...
0
votes
1answer
70 views

How to encode and decode a const char *

This is the first time for me to try to serialize/deserialize an object. One member of the object is a type of const char *. ----------------------------------------Added info ...
1
vote
1answer
46 views

Annoying warning: Integer constant not in the range of enumerated type 'UIViewAnimationOptions'

When writing code like the following in XCode 5 using clang set to C11/C++11: [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat ...
1
vote
0answers
32 views

Trim UIImage border

Here's an example of an image I would like to trim. I want to get rid of the borders around the image (in this case the top and bottom black bars). I found a library on Github: CKImageAdditions, ...
4
votes
2answers
65 views

List of classes in project Objective-c

I am playing around with some reflection in Objective C (iOS app) and building a customized testing environment, and I am trying to get a list of classes that I have created in my project, so I can ...
0
votes
2answers
54 views

How to share a preferences file between two sandboxed applications?

In a project, I have an application and a helper running as an agent. The main application is used to set user preferences and can be unused for a while. The helper application that is launched by ...
-1
votes
1answer
43 views

gcc compile error: passing argument to parameter here [closed]

I'm just getting started with c and objective c, and I made this simple script: #import <Foundation/Foundation.h> #include <stdio.h> int s; int main() { NSString *s = (@"Hello World"); ...
1
vote
0answers
44 views

Generate a JavaScript/JSON object from an Objective-C enum

I want to convert Objective-C enums to JavaScript objects that will be used in some JavaScript parts of my program. glib-mkenums would do exactly what I need: glib-mkenums --eprod "var @EnumName@ = ...
1
vote
1answer
114 views

Difference between C and Objective C language [closed]

I need some good differences, I have gone through this link http://forums.macrumors.com/showthread.php?t=152467, but not helped me. This has been asked in many interviews too.
0
votes
2answers
80 views

First language for iOS? Rubymotion vs C, Objective C vs others [closed]

I have no coding experience except for some basic VBA programming to help out my financial models (read: I have 0 coding experience or background). However, I would love to start developing for the ...
0
votes
1answer
34 views

Why does the main function in objective-c preserve a C-style?

This could sound a bit weird. In main.m, it is written as such: int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, ...
1
vote
2answers
42 views

OSX Serial read freeze / hang

I'm writing a serial communication wrapper class in Objective-C. To list all serial available modems and setup the connection I'm using pretty much the same code as used in this example project by ...
0
votes
3answers
74 views

Why is my code only printing the first element in the array in Xcode?

The resulting code only prints out the first element of the array in my Xcode, even though I pass it three words. Any reason why? char str[100] = {0}; NSLog(@"Please enter three words: "); ...
0
votes
2answers
53 views

Why is converting my float to an int making the number negative?

NSTimeInterval expirationTime = (secondsSinceUnixEpoch*1000)+120000; expirationTime = ceil(expirationTime/2); int expirationInt = (int)expirationTime; NSLog(@"%d", expirationInt); The log output is ...
2
votes
1answer
58 views

Identifying the return type of a method during run-time (Objective C) [closed]

I have declared multiple methods in a custom Objective-C class. - (float)method1; - (CGPoint)method2; - (NSString *)method3; - (void)method4; I want to know whether it is possible to be able to ...
-1
votes
0answers
38 views

Blackboard architecture and void * pointer (objective c)

vI habe a blackboard architecture for a game. It consists of a blackboard and BlackboardData items. The BlackboardData items are made of identifier type value where type tells me what it is like a ...
0
votes
2answers
75 views

(Objective C) Save changes in sqlite database

I'm creating an app for my school project that has to write data to my sqlite database. It works, as long as the app is running active but as soon as the app closes, my added data is gone and when I ...
0
votes
0answers
40 views

How to get disk info (read/write bytes) by process name/pid programmatically in OS X?

I know how to get total write/read disk info but don't know how to get disk info (read/write data) by process name/pid programmatically in OS X? It could be Objective C or C. I reviewed this topic ...
1
vote
2answers
61 views

Weird characters in printf

My environment: Xcode5, iOS, Objective-C/Objective-C++ mix. I am trying to figure out what causes the next problem. I am writing my own logging function: int _me_log(const char *fmt, ...) { ...
0
votes
0answers
18 views

NSAccessibilityWindowAttribute returning memory address and process ID

Thanks for your help in advance. Please help. CFTypeRef _windowAttribute; AXUIElementCopyAttributeValue(newElement2, (CFStringRef)NSAccessibilityWindowAttribute, (CFTypeRef*)&_windowAttribute); ...
0
votes
2answers
40 views

SQLite update column if another column exists

Okay, so I'm not sure exactly how to name this question but I can explain what my issue is. I'm creating a webbrowser, and using an sqlite database to store the history. When the page finished loading ...
0
votes
1answer
73 views

Convert 1 byte to int Objective-C

I have an NSData packet with data in it. I need to convert the byte at range 8, 1 to an int. To get the data at that location I do the following. NSData *byte = [packet ...
3
votes
1answer
51 views

Is there a way to show where LLVM is auto vectorising?

Context: I have several loops in an Objective-C library I am writing which deal with processing large text arrays. I can see that right now it is running in a single threaded manner. I understand ...
0
votes
2answers
65 views

Resources folder path in cocoa app

I am working on Mac OS X app which using some c files, and i have a configuration file i add it to the app resources. My question is "What is the relative path of resources folder?" I tried ...
2
votes
2answers
91 views

How to declare a C-array in header file?

I have a C-array of CGPoint that I want to declare in the header file .h. CGPoint checkPoint[8]; But when I try to give it a value in .m: checkPoint[8] = { //<-- Error Here CGPointMake(0, ...
0
votes
1answer
64 views

Conversion between NSData and void *

In my iPhone app, I have to use MQTT's C based static library to send and receive its payload, the payload must be void *, I need to send messages such as text, picture and voice This is my sending ...

15 30 50 per page