Questions tagged [objective-c++]

120648 questions
1

votes
1

answer
185

Views

Stop Sound playing on Node in SceneKit

I have the following code for a gesture recogniser that plays a horn, when tapped, and stops when it is released: @objc func didPressHorn(_ sender: UILongPressGestureRecognizer) { let tapLocation = sender.location(in: sceneView) if sender.state == .began { if (wasNodeTapped(node: hornNode!, tapLocat...
Pascal
1

votes
4

answer
69

Views

Stored UIColor as Strings in NSMutableArray but unable to display the colors

Below is my NSMutableArray: NSMutableArray *bgColorArr = [NSMutableArray arrayWithObjects: @'[UIColor colorWithRed:0.90 green:0.22 blue:0.21 alpha:1.0]', @'[UIColor colorWithRed:0.26 green:0.63 blue:0.28 alpha:1.0]', @'[UIColor colorWithRed:0.85 green:0.11 blue:0.38 alpha:1.0]', @'[UIColor colorWith...
Madhu
1

votes
1

answer
390

Views

Setting HTTP Header Fields for AVURLAssets

I'm attempting to load a video file that requires a token in the header. I learned on Stackverflow that this may be possible from looking at the following question. The problem is that I don't believe AVURLAssetHTTPHeaderFieldsKey is public or I have written my asset variable incorrectly. What I'...
Cosmic Arrows
1

votes
2

answer
51

Views

How do you satisfy the 'lineOrigins' argument in CTFrameGetLineOrigins() in Swift? [duplicate]

This question already has an answer here: Issue with CoreText CTFrameGetLineOrigins in Swift 1 answer I'm trying to figure out CTFrameGetLineOrigins from here: CTFrameGetLineOrigins Got Incorrect Origins, and trying to convert the ObjC to Swift. Obj-C: CFArrayRef lines = CTFrameGetLines(frame); siz...
Kevin Wang
1

votes
1

answer
159

Views

NSErrorDomain + NS_ERROR_ENUM makes type lookup ambiguous. Why?

I have an error that used to look like this in Objective-C NSString * const JKConfigurationErrorDomain; typedef NS_ENUM(NSInteger, JKConfigurationCode) { JKConfigurationCodeUnknown, JKConfigurationCodeSomethingBad, JKConfigurationCodeParsing, }; Now this is ugly to use in Swift. But since Swift 4, w...
Joachim Kurz
1

votes
1

answer
34

Views

Do comments get stripped out of executable Objective-C

if we have a lot of comments in our iOS app does it slow down the program or do they get stripped out during compilation ?
IzzyJM
1

votes
1

answer
23

Views

MKMapView not full screen with TabBar

I am making a simple app to display various things and on one of the tabs I like for it to display a map of your current location. It seems for some reason, even though in Xcode the controller is stretched towards the bottom, it looks like when run in the simulator, an area of unused space and I am...
Jon Weinraub
1

votes
1

answer
56

Views

White spaces in Objective-c

I added a feedback box inside my IOS application, and I want it to take only text to submit the response from the user, but when I tried to enter a white spaces inside the box it took it as a text and accept the submitting! How can I prevent that?
Batool Mustafa
1

votes
1

answer
69

Views

Build error integrating Clevertap to a Reactnative Application

I'm trying to integrate clevertap with native react and when I include 'use_frameworks!' in cocoa pods to be able to use #import a compilation error is generated in UMLCore Already make the link of the application with clevertap Install all the package throught 'yarn install' Install the pods thr...
Carlos Cabezas
1

votes
1

answer
23

Views

Error “Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT) ” in a variadic function

I have this method which supposed to take variable number of String arguments and put them in an NSMutableArray: - (id)testArray: (NSString*) question, ... { NSMutableArray* questionsArray = [[NSMutableArray alloc] initWithObjects:question, nil]; id eachObject; [_questionsArray addObject:question];...
Fady E
1

votes
1

answer
4.8k

Views

Polymorphism in objective C

I guess there is no operator overloading in objective C. Exact function overloading as in C++ is not present. In what way polymorphism is implemented in objective C?
Krishnan
0

votes
1

answer
22

Views

Swift iOS -Argument labels '(float3:)' do not match any available overloads

I downloaded the MetalPetal pod and then tried to use some files from another pod. I keep getting these errors for (float3:) and (float2:): The file is in Objective-C and Obj-C isn't my forte. I tried importing #import to the file but it made no difference. How can I fix these errors? .h file: #imp...
Lance Samaria
1

votes
2

answer
50

Views

Complex Multi-Device Orientation Handling

I have a universal application running both on iPads and iPhones. The application starts with a .xib file, built in interface builder, which acts as the launch image. Once the app launched, it switches to the appropriate view controller based on device size set in the app delegate: CGSize screenSize...
Gergely Kovacs
0

votes
0

answer
2

Views

how to install skype web plugins in webkit?

I want to make audio and video call from skype, skype i have loaded using url https://web.skype.com/ in webview but audio and video options and disabled in webview for that i think i need to install web plugins of skype so how do i acheive that I followed this and this but that doesn't seem to help...
zack
1

votes
3

answer
2.8k

Views

How do I make my UITableView Scroll?

In the following code, I push a new UITableView when I click on a button. The TableView has 25 rows. I can see the first 9 row and the 10th row got cut off. I can't scroll down to view the rest of the rows. How do I make the TableView scrollable? Thank you. - (IBAction)showListPicker:(id)sender...
atbebtg
0

votes
0

answer
23

Views

How to know latest ios version available programatically in swift?

Is there any way we can find out the latest ios version available on device programmatically. Like latest ios version now is 12.2
Habib Ali
1

votes
1

answer
1k

Views

iOS 4.3 crashes when uploading video

I have an iPhone app that uploads images and video to a web service using ASIHTTPRequest. Everything works great on devices running iOS 5, but crashes on 4.3 and below devices after returning from the UIImagePickerController. The video is compressed bu=y the picker, then the app crashes. Below is th...
Alpinista
1

votes
2

answer
82

Views

bundleAtPath gives me the wrong path

I've put a actual folder inside my app project and i would like to get the content of the folder out. I've tried the code below, but it always sends me to my home directory on my computer. How do you get to root level in your app? NSArray *test = [[NSFileManager defaultManager] contentsOfDirectoryAt...
Niels Sønderbæk
0

votes
1

answer
23

Views

Using an Objective-C typedef void in Swift

I am using an Objective-C API in a new Swift environment. For the most part everything is working great but I'm getting stuck on a typedef issue. The API has a typedef defined as: typedef void* TESTHANDLE; Usually in Objective-C I'd simply use this like declaring any kind of variable: TESTHANDLE New...
Dan James Palmer
1

votes
1

answer
540

Views

Is there any way to display part of an image in a UIImageView?

I only want to display part of an image in an UIImageView, not the whole image. How do I do that?
aeubanks
1

votes
4

answer
7.2k

Views

Remove spacing between UITableViewCells

I have UITableViewCells in the same section which have gaps between them. I coloured each cell's contentView background and did an NSLog to show that it's the same height as the cells. Still, there's a gap between them. They're definitely in the same section as each other. Any ideas as to what could...
Andrew
1

votes
1

answer
744

Views

glBlendFunc transparency in OpenGL with GLKit

I'm using GLKit for an iPad app. With this code I setup blending: glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); It works fine, but when I try to get a screenshot the blend mode seems wrong. It doesn't matter if I use GLKit's snapshot or glReadPixels. This is what I get when...
Odrakir
1

votes
1

answer
1.3k

Views

NSURL _CFURLRequest]: unrecognized selector sent to instance 0x8d96de0

I am trying to show a webpage in a uiWebView but my app crashes. the app crashes when trying to call NSURLRequest *urlRequest =[NSURL URLWithString:@'http://www.google.com']; I get the following error message: 2013-12-07 04:06:09.443 Reac[5374:2703] -[NSURL _CFURLRequest]: unrecognized selector sent...
Nilsymbol
1

votes
1

answer
2k

Views

Create thumbnail from video ios?

I got thumbnail from video in photo library, now I want add duration and camera icon on the thumbnail like image . Have any suggestion? thanks.
LViet
1

votes
1

answer
1.2k

Views

iOS OpenCV cvtColor unknown array type error

I am starting with OpenCV on iOS and the first thing I wanted to achieve was transforming a colour image into a grey one. My first attempt was successful I was obtaining a Mat with 'CV_8UC1' option and then converting it back to a image. The code is as follows: UIImage *image = [UIImage imageNamed:...
Fawkes
1

votes
2

answer
1.7k

Views

Set value for key in case of NSInteger

I am trying to set a value in core data using setValue:forKey: but it is throwing an error: (Use of undeclared identifier: 'newID'} when trying to save an NSInteger. Can anyone suggest the correct syntax? NSInteger newID = lastID+1; [record setValue:newID forKey:@'localid'];//error Got similar erro...
user1904273
1

votes
3

answer
815

Views

Programmatically select UITableView cell not in current view

So it's easy to select a row that is currently in the UITableView. For example, to select the first row: [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionNone]; Say that I have an array that is the data source for t...
Alex
1

votes
2

answer
1.2k

Views

Filter NSDictionary based on array of keys

I have an array of 'whitelisted' keys and I want to filter an NSDictionary based on those keys; NSArray *whiteList = @['one', 'two']; NSDictionary *dictionary = @{ @'one' : @'yes', @'two' : @'yes', @'three' : @'no' }; NSDictionary *whiteDictionary = [dictionary dictionaryWithValuesForKeys:whiteList]...
lostintranslation
1

votes
2

answer
511

Views

Setting delegate for UIGestureRecognizer giving warning

setting delegate for UITapGesture giving warning Here is my code : UITapGestureRecognizer *tapOtherPlayers = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapcollectionViewOtherPlayers:)]; tapOtherPlayers.delegate = self; [tapOtherPlayers setNumberOfTapsRequired:1]; [collecti...
1

votes
1

answer
2k

Views

iOS - Merge two video into single video file with audio

I want to merge 2 video files with single file with audio. I am able to merge 2 video files, but after merging ouptut video file does not have any audio sound. Even both old video file have proper audio.I have follow this tutorial: https://www.raywenderlich.com/13418/how-to-play-record-edit-videos-i...
Ravi
1

votes
0

answer
9

Views

camera.activeFormat not getting applied

we are trying to set a specific camera frame resolution in our iOS application (written in Objective-C) which is not defined in the AVCaptureSessionPreset. With the following code we would like to set the frame dimensions to a specific width: for ( AVCaptureDeviceFormat *format in [self.camera forma...
Entertain
1

votes
0

answer
8

Views

How to test stdin function in Objective-C?

I have a readline function which waits for input from stdin. When I run the function in XCTest, it shows a prompt and waits for input. How to pass an input string so that the readline can read it from stdin in XCTest case? char *input = readline(prompt); XCTAssertEqualObjects(input, [@'hello' UTF8St...
jsloop
1

votes
0

answer
8

Views

NSMetadataQuery is getting deallocated without first calling stopQuery?

I am having problem which prints this log message when i run the app is being deallocated without first calling -stopQuery. To avoid race conditions, you should first invoke -stopQuery on the run loop on which -startQuery was called this my medatadata query @property (strong) MetadataQuery *query;...
zack
1

votes
1

answer
340

Views

Error: @“Bridge module %@ does not conform to RCTBridgeModule”

I'm new in React Native and I would like to use native modules in order to get a battery status of the phone. The problem is that I'm getting fallowing error: @'Bridge module %@ does not conform to RCTBridgeModule'. I'm guessing that it is class related but I'm not familiar with a Objective-C syntax...
Murakami
1

votes
4

answer
65

Views

Objective C: A cleaner way to check if a string isn't empty before creating and assigning a string to a dictionary key?

I am creating an NSMutableDictionary and assigning an NSString (test and test1) to a parameter key. NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; if (test.length) { dictionary[@'test'] = test; } if (test1.length) { dictionary[@'test1'] = test1; } This method does work. Howeve...
Curt Rand
1

votes
1

answer
78

Views

Using fork objc

When detecting jailbroken device, why do most examples terminate app if fork process fails? Doesn't that mean device is not jailbroken, so everything is ok, without any child process? int pid = fork(); if (!pid){ exit(0); } if (pid >= 0) { return YES; }
AnonProgrammer
1

votes
1

answer
39

Views

Use settings.bundle of custom framework in application

I am creating a framework for iOS applications. I need some configurable parameters from end users at run time like key, specific set of characters or something else. These things will be used in my framework not in the application. So I have created Settings.bundle for my framework and I want that...
Rock Balbao
1

votes
1

answer
63

Views

Correct way to handle deprecated API

There is an Obj-C file which is included into several projects with different deployment target. This file has following codeline: [[UIApplication sharedApplication] openURL:url]; When I compile project targeting iOS 10, I get a warning: 'openURL:' is deprecated: first deprecated in iOS 10.0 - Pleas...
Nick
1

votes
2

answer
55

Views

Cocoa class member variable allocated inside function call nil unless forced to init/load

I come from a C/C++ background and am currently learning a bit about Cocoa and Objective-C. I have a weird behavior involving lazy initialization (unless I'm mistaken) and feel like I'm missing something very basic. Setup: Xcode 10.1 (10B61) macOS High Sierra 10.13.6 started from a scratch Cocoa pro...
JLL
1

votes
1

answer
39

Views

What difference among boolean types in Objective-C?

I tried exchange the boolean types between them, and it worked. But the CFBooleanRef presented a warning. After all, what's the difference between them? boolean_t a = true; bool b = a; Boolean c = b; BOOL d = c; CSSM_BOOL e = d; _Bool f = e; CGPDFBoolean g = f; CFBooleanRef h = g;
Luan Sobreira

View additional questions