Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x

Objective-C Programming

175

Solutions

203

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

IOS 11, xcode 9

   // Creating view controller for a new contact
        ABNewPersonViewController *c = [[ABNewPersonViewController alloc] init];
        [c setNewPersonViewDelegate:self];
        [c setDisplayedPerson:person];
        CFRelease(person);
        [self.navigationController pushViewController:c animated:YES];
        [c release];


    - (void)newPersonViewController:(ABNewPersonViewController *)newPersonView didCompleteWithNewPerson:(ABRecordRef)person {
        if (person) {
            ABAddressBookRef addressBook = ABAddressBookCreate();
            ABAddressBookAddRecord(addressBook, person, nil);
            ABAddressBookSave(addressBook, nil);
            CFRelease(addressBook);
        }
        [self.navigationController popViewControllerAnimated:YES];
    }

i'm getting error ABNewPersonViewController is not navigation controller.

[CNUI WARN] <CNContactViewController: 0x7f984b9a6400> is added to a controller that's not a navigation controller, we'll update the parent navigation item <ABNewPersonViewController: 0x7f984b12d430> automatically
0
Ask an Anonymous Question!
LVL 10
Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

I have done a little Obj-C development years ago and do recall that the iPhone was great at protecting my app's data from the prying eyes of other apps running on my iPhone.

Is this completely safe? Or are there risks of having secret data belonging to one app being read by another?

And what about the database?

I think the database was called SqlLite? Is this still true?

Does the iPhone completely protect my app's data stored in the DB?

Thanks
0
Filelist like:
/Users/Utilizator/Documents/sample.sh

Open in new window

Many things, but no results (
0
How to write test case for c program
0
Hi Experts,

I am very new into iOS programming and I need your help.

I have a simple code in XCode that uses GET to send data to URL and I want to change this to a POST.

When I test the call, both methods work okay, but running from XCode on simulator, GET works okay but POST returns empty value.

AFHTTPRequestOperationManager returns success.

Here is the code for both:

- (IBAction)cmdTestGET:(id)sender {

    AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] init];
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
   
    [manager GET:@"http://mytestwebsite/index_test.php"
      parameters: @{@"method":  @"Test_GET",
                    @"data":    @"Hello GET!"}
         success:^(AFHTTPRequestOperation *operation, id responseObject) {
             NSLog(@"JSON: %@", [responseObject description]);
         }
         failure:^(AFHTTPRequestOperation *operation, NSError *error) {
             NSLog(@"Error: %@", [error description]);
         }];
}

- (IBAction)cmdTestPost:(id)sender {
   
    AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] init];
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
   
    [manager POST:@"http://mytestwebsite/index_test.php"
                parameters: …
0
So I would like to make this program read a user inputted matrix instead of the one that is provided in the main function. Also, the limit to the 2d matrix should be more than 9, but no more than about 100 and should also be user defined.

The main function purpose that I had in mind would be something like:
int main(){
    int graph[V][V];
  printf("Enter number of towns: ");
  scanf("%d", V);
  printf("Enter distance matrix");
  scanf("%d", graph[V][V]);
  dijkstra(graph, 0);
return 0;}

Open in new window

which is giving me a great headache trying to write.. Any help would be greatly appreciated. Thank you.


// A C / C++ program for Dijkstra's single source shortest path algorithm.
// The program is for adjacency matrix representation of the graph
  
#include <stdio.h>
#include <limits.h>
  
// Number of vertices in the graph
#define V 9
  
// A utility function to find the vertex with minimum distance value, from
// the set of vertices not yet included in shortest path tree
int minDistance(int dist[], bool sptSet[])
{
   // Initialize min value
   int min = INT_MAX, min_index;
  
   for (int v = 0; v < V; v++)
     if (sptSet[v] == false && dist[v] <= min)
         min = dist[v], min_index = v;
  
   return min_index;
}
  
// A utility function to print the constructed distance array
int printSolution(int dist[], int n)
{
   printf("Vertex   Distance from Source\n");
   for (int i = 0; i < V; i++)
      printf("%d \t\t %d\n", i, dist[i]);
}
  
// Funtion that 

Open in new window

0
I am a rookie with programming but wanted to delve into programming for Androids.  What language should i use?  or what development program.?  also, does this language translate to coding pretty well if i wanted to create the same app for ios.
any commentary would be greatly appreciated
0
i am using turbo c++ in my pc and the cursor has an issue that when i type the code and i have to enter a line in my typed code then the cursor simply moves to next line instead of adding a line .Moreover on doing any sort of correction in data like adding some new words in a particular line then the succeeding words get erased instead of shifting...
0
I am developing an OS X application which is dealing with powerpoint presentations. Now I am stuck with a scenario of minimized powerpoint presentation. Please let me know Is there any way to activate a minimized powerpoint presentation by using applescript? OR activate a particular presentation which is not in the top window?

Thanks in advance.
0
I need to open my OS X application when any powerpoint presentation opens.
I got VBA call back when powerpoint open (Auto_Open()). But I need a call back for each presentation open.

 In windows we can open  each presentation in separate powerpoint app (difference instance).
In Mac , Powerpoint app will open once and all presentation will open under same powerpoint application .

I need a call back when each presentation file open and I need to do run code snippets in my cocoa application.
0
Tech or Treat!
LVL 10
Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

{
  "EmployeeApp": [
    {
      "id": "1",
      "name": "Mr.ABC",
      "email": "ABC@XYZ.COM",
      "address": "xxx",
      "hr_review": {
        "1": {
          "hr_name": "Mr. f r",
          "hr_id": "13",
          "hr_comment": "he is one of the nice employee for company",
        },
        "2": {
          "hr_name": "Mr. b c",
          "hr_id": "14",
          "hr_comment": "Takes pride in work and strives to improve work performance",
        }
      }
    },
    {
      "id": "2",
      "name": "Mr.PQR",
      "email": "PQR@XYZ.COM",
      "address": "xxx",
    "hr_review": {
        "1": {
          "hr_name": "Mr. f r",
          "hr_id": "13",
          "hr_comment": "Forms and required paperwork are completed on time with minimal errors.",
        },
        "2": {
          "hr_name": "Mr. b c",
          "hr_id": "14",
          "hr_comment": "Maintains good working relationships with coworkers",
        }
      }
    }
  ]
}

Open in new window

0
I created a OSX application which contains powerpoint slides and can add these slides to any existing powerpoint presentation. I am using applescript and vba script to add slides from my OSX application to powerpoint. In Powerpoint 2016 mac version it is asking for "Grand file Access" permission popup always when I am adding slides.

Is there any way to remove this popup programatically.
Screen-Shot-2016-09-30-at-11.51.00-A.png
Screen-Shot-2016-09-30-at-11.51.14-A.png
And some times it is not pointing to the correct file location, and at that time the "Grant Access" button is not enabled.

Please help me. Thanks in Advance.
0
I need to observe powerpoint actions in my OSX app.
Scenario: I need to perform some actions in my OSX application when user clicks on save button in PowerPoint. Is there any ways to to this. I have achieved this functionality in Windows application by VBA Macro Events, but in PowerPoint Mac version the VBA Macro Events are not supported.
Thanks in advance
Please help me
0
When working with reverse geocoding some address could be ambiguous for given location and the returned array of placemarks can contain multiple values (address gets multiple hits). This happens very rarely. Usually practice is to take first or last object from given array. So, I want to know why is this common practice. I've looked in Apple documentation and they also took object at index 0. Does the first object contains the most accurate address if the array of placemarks contains more than one object for given location (lat, long)? Thanks for your answers.
0
Hi,
Does 2nd line below scan through all Worksheet within Excel file? If not, how to adjust it to scan through all Worksheets, except one specific sheet with a given name?
                    Excel.Worksheet Worksheet0;
                        ...
                        foreach (Excel.Worksheet sheet in Book0.WorkbookPart.Workbook.Descendants<Sheet>().Where(s => s.Name == Worksheet0))

Open in new window

0
Hi,
How to correct this
Error	2	'DocumentFormat.OpenXml.Packaging.SpreadsheetDocument' does not contain a definition for 'WorksheetParts' and no extension method 'WorksheetParts' accepting a first argument of type 'DocumentFormat.OpenXml.Packaging.SpreadsheetDocument' could be found (are you missing a using directive or an assembly reference?)

Open in new window


due to 2nd line below?

                    SpreadsheetDocument Book0 = SpreadsheetDocument.Open(openFileDialog1.FileName, false);
                    WorksheetPart worksheetPart = Book0.WorksheetParts.First();

Open in new window

0
Hi,
How to correct
Error	2	The type or namespace name 'Packaging' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)

Open in new window


due to this line?

using System.IO.Packaging;

Open in new window

0
Hi,

It does take nearly 30 minutes to finish scanning these two sheets
https://app.box.com/s/zkm75d29hef82zct7bkw784iro8kmn64

using such codes
                    foreach (Excel.Worksheet sheet in Book0.Worksheets)
                    {
                        Excel.Range usedRange = sheet.UsedRange;

                        RowID++; Worksheet0.Cells[RowID, 1] = "^^^^" + sheet.Name + "^^^^"; RowID++;

                        foreach (Excel.Range row in usedRange.Rows)
                        {
                            RowID++;
                            for (int i = 0; i < row.Columns.Count; i++)
                                /*if (!string.IsNullOrEmpty(rowData[i]))
                                    j = 0;
                                else
                                    j++;*/

                                if (!string.IsNullOrEmpty(Convert.ToString(row.Cells[1, i + 1].Value2)))
                                {
                                    Worksheet0.Cells[RowID, i + 1] = row.Cells[1, i + 1].Value2;
                                    Worksheet0.Cells[RowID, i + 1].Interior.Pattern = row.Cells[1, i + 1].Interior.Pattern;
                                    ...

Open in new window

Why? Any other way to efficiently/quickly read the attached two Excel Worksheets?
0
Hi,
I get Error and STacktrace below

Exception from HRESULT: 0x800A03EC    at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Microsoft.Office.Interop.Excel.Range.set__Default(Object RowIndex, Object ColumnIndex, Object value)
   at WindowsFormsApplication2.Form1.menuItem5_Click(Object sender, EventArgs e) in c:\dp13\General Application\WindowsFormsApplication5\WindowsFormsApplication2\Form1.cs:line 120

Open in new window

due to last line below
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.Excel;
using System.IO.Compression;
using System.Diagnostics;
using System.Text; // This was needed to make ASCIIEncoding function
using Excel = Microsoft.Office.Interop.Excel;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        ...
        private void menuItem5_Click(object sender, System.EventArgs e)
        {
            string File1;
            File1 = "C:/dp2/List0.txt";
            const string fileName = @"c:/dp2/List0.dat";

            int RowID = 0, ColID = 0;
            Stopwatch stopwatch = new Stopwatch();
     

Open in new window

0
Free Tool: Subnet Calculator
LVL 10
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Hello Experts,

I have built a Windows desktop application that reads through a bunch of files and folders and analyzes them, and creates image previews while it loops through them.

Problem is that sometimes, when the file/folder structure is too large, it is taking nearly 100% of the system processor and RAM. I was able to successfully limit the RAM to take maximum 20% of the system's total, but I cannot manage to limit the CPU allowed resources.

Can you please share a piece of code  with me that will do the trick?
0
Hi,
To the codes like
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public void AddMenu()
        {
            MainMenu mnuFileMenu = new MainMenu();
            this.Menu = mnuFileMenu;
            System.Windows.Forms.MenuItem myMenuItemFile = new System.Windows.Forms.MenuItem("&File");
            System.Windows.Forms.MenuItem myMenuItemNew = new System.Windows.Forms.MenuItem("&New");
            mnuFileMenu.MenuItems.Add(myMenuItemFile);
            mnuFileMenu.MenuItems.Add(myMenuItemNew);
        }
        private void Form1_Load(object sender, System.EventArgs e)
        {
            AddMenu();
        }
    }
}

Open in new window

why can't the menu be shown to the form, by this project below?
https://app.box.com/s/oxsbqcr0kd72e4y3ww8ugogigoroibx0
0
Hi, I'm looking for a video tutorial series for Cocoa and Swift 2. I've searched high and low, but none that are current with Xcode 7.x and Swift 2. I've found a couple that are great, but most are Xcode 6 and Objective-C or iOS with Swift 1, but my question is specific - Xcode 7.x and Swift 2.

Does anyone have a link to a good tutorial series that meets those requirements?

Yes...I know that iOS is very similar to Cocoa, but I'd really like to find a tutorial set for Cocoa and not iOS.

Thanks,
Fulano
0
Hi,
Any advice to these
namespace ClassLibrary1
{
    public class Class1
    {
        bool allowappend = true;
        string File1="c:/dp2/oup.txt";
        string s = "9quali52ty3";
        byte[] ASCIIValues = Encoding.ASCII.GetBytes(s);
        foreach(byte b in ASCIIValues) {
                using (StreamWriter sw = new StreamWriter(@File1, allowappend, Encoding.Unicode))
                {
                    sw.WriteLine(b);
                    sw.WriteLine("");
                }
}
}
}

Open in new window


due to these
Error	1	Invalid token 'foreach' in class, struct, or interface member declaration	C:\dp11\ClassLibrary1\ClassLibrary1\Class1.cs	38	9	ClassLibrary1
Error	2	; expected	C:\dp11\ClassLibrary1\ClassLibrary1\Class1.cs	38	24	ClassLibrary1
Error	3	Invalid token ')' in class, struct, or interface member declaration	C:\dp11\ClassLibrary1\ClassLibrary1\Class1.cs	38	38	ClassLibrary1
Error	4	; expected	C:\dp11\ClassLibrary1\ClassLibrary1\Class1.cs	39	97	ClassLibrary1
Error	5	Invalid token '(' in class, struct, or interface member declaration	C:\dp11\ClassLibrary1\ClassLibrary1\Class1.cs	41	33	ClassLibrary1
Error	6	Invalid token ')' in class, struct, or interface member declaration	C:\dp11\ClassLibrary1\ClassLibrary1\Class1.cs	41	35	ClassLibrary1
Error	7	Invalid token '(' in class, struct, or interface member declaration	C:\dp11\ClassLibrary1\ClassLibrary1\Class1.cs	42	33	ClassLibrary1
Error	8	Type or namespace definition, or end-of-file expected	

Open in new window

0
hello
  i would like to know how to determine the location of an object pointed at by the camera on an ios and android,
My thinking is the location of the user/camera is determined by using the location services on the mobile device, utilize the compass and camera in the phone to determine the distance to object(building) in the center of the camera view?
utililize the distance and compass/angles to determine the lat/lon of the pointed at building. Reverse geo-code the coordinate to get the actual address.
Is this feasible? are there any API's provided by Android/IOS that would facilitate this?
0
Hi,
For Chinese word, I think there're many tens of thousands for use. Is there any automatic way to list out all Chinese word, from anything, like a Chinese dictionary?

But I can only select less than 2 thousand distinct Chinese words from these

http://www.zhongwen.com/

http://www.mdbg.net/chindict/chindict.php?page=cedict

Any other advice?
0

Objective-C Programming

175

Solutions

203

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!