spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » IOS » Page 4
In field of view with SpriteKit rotational coordinate system
If you clamp the angles to between PI and -PI then the math is a bit simpler: let PI=CGFloat(M_PI) var spriteAngle:CGFloat=0 let fieldOfView:CGFloat=0.5 var targetAngle:CGFloat=0 while spriteAngle>PI { spriteAngle=spriteAngle-2*PI } while spriteAngle < -PI { spriteAngle=spriteAngle+2*PI } while targetAngle>PI { targetAngle=targetAngle-2*PI } while targetAngle < -PI {

Categories : IOS

Calling random objectId from Parse
Short answer: On your class, make a variable with a number in it, increment that number so it is always unique and sequential. Then call Parse to get the total number of objects and run a RAND to get a number between 0 and your Max number. Then query for object with that number in the right field. Longer answer: Try something like this: var query = PFQuery(className: "VoteCount") query.countObje

Categories : IOS

AutoLayout: Unable to simultaneously satisfy constraints log unclear
In your constraints there is an extra constraints that not require. For example, Suppose you given a constraints to leading and trailing and also you are giving a width constraints that this will lead to the warning to the compiler. because either you need a constraints for width or trailing constraints otherwise compiler will confuse what to take width or trailing. For auto layout you need t

Categories : IOS

How to refresh marker info window in iOS Google maps with AFnetworking Image cache?
I solved the problem as following I use this property as the info window. @property (nonatomic) MyInfoWindow* infoWindow And this is how I wrote the delegate method of GMSMapViewDelegate - (UIView*)mapView:(GMSMapView*)mapView markerInfoWindow:(GMSMarker*)marker { //Prepare Data MyEvent* selectedEvent = [EventManager eventForEventID:marker.objectID]; //Prepare Thumbnail URL

Categories : IOS

How to trigger notifications using WatchKit
Its explained in Notification Essentials that iOS decides whether to display that notification on the iPhone or on Apple Watch . So I dont think(as of now) there is anything that can be done from the app to trigger Notifications specifically in the watch. Edit: It looks like theres a bug in 8.2 beta. WatchKit Known Issues When viewing a notification in iOS simulator, clicking on the

Categories : IOS

What is the best way to define ivar?
readwrite This qualifier is unnecessary as it is the default behavior. Don't use it or it might confuse people. self. syntax call the getter and setter of your property, which can be explicitly defined by propertyName or setPropertyName. Try using self. syntax as it makes things easier if one day you'll need a getter or setter. Accessing property through _ syntax will access the property direc

Categories : IOS

POST application/x-www-form-urlencoded to Server with AFNetworking 2.0
Sounds like a server issue, if an issue at all. The server returns a 200 code, which usually denotes success. As posted, the code is sending the POST body as application/x-www-form-urlencoded. Unless you're expecting the server to echo the response data, I'm not sure what the issue is...

Categories : IOS

Launch Watch App into middle view
WKInterfaceController's becomeCurrentPage() should be what you're looking for. Let's create a new class for the center view controller, CenterPageViewController, and change its initWithContext: method as follows import WatchKit class CenterPageViewController: WKInterfaceController { override init(context: AnyObject?) { super.init(context: context) super.becomeCurrentPage(

Categories : IOS

Co-mingling "default" data with user-supplied data in Core Data
I had a similar situation in my app. It has sample data, but the sample data is designed to be edited by the user, and has metadata attached to it that is user specific. In other words, the data is mutable, and belonged with the rest of the user's personally created data. At one point, the app was rejected. I first appealed to the reviewer, explaining that the data was mutable, and personal to th

Categories : IOS

Using Navigation controller for a start screen ios
This answer is based on the one here, but has been translated to Objective-C. The problem that you are facing is that an SKScene does not have direct access to it's viewController, but just the view in which it is contained. You need to create a pointer to it manually. This can be done by creating a property for the SKScene: @interface GameScene : SKScene @property (strong, nonatomic) UIViewCon

Categories : IOS

How to check for an undefined or null variable in Swift?
"All I want to do is execute the if-statement if 'goBack' is undefined. How can I do that?" To check whether a variable equals nil you can use a pretty cool feature of Swift called an if-let statement: if let goBackConst = goBack { firstName.text = passFirstName1 lastName.text = passLastName1 } It's essentially the logical equivalent of "Can we store goBack as a non-optional constant,

Categories : IOS

Why UIKit Dynamics doesn`t work?
Your UIDynamicAnimator is deallocated when viewDidLoad returns. It can't animate anything if it's deallocated. Make a property: @property (nonatomic) UIDynamicAnimator *animator; And set it: self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];

Categories : IOS

With custom view controller transitions, where do I get to hide the status bar?
The following code will fix the crash. let controller = presentingViewController as UINavigationController let ctl = controller.topViewController as ViewController ctl.testFunction()

Categories : IOS

Using application:willFinishLaunchingWithOptions instead of application:didFinishLaunchingWithOptions:
application:willFinishLaunchingWithOptions: Tells the delegate that the launch process has begun but that state restoration has not yet occurred. Vs application:didFinishLaunchingWithOptions: Tells the delegate that the launch process is almost done and the app is almost ready to run. So the difference is clearly visible. For details you can follow UIApplicationDelegate So application:willF

Categories : IOS

How to query/curl for Parse installation without objectId
If you want to send push to individual user then you need to add some additional info to the installation object for example when the user sign in. So other users can query instalations to find a specific ones. I've done it like this: PFInstallation *installation = [PFInstallation currentInstallation]; installation[@"client"] = [KZClient currentClient]; installation[@"phone"] = [KZClient currentC

Categories : IOS

Where/when/how to set tabBarItem font attribute properties?
I have used this code in didFinishLaunchingWithOptions and it worked for me. NSDictionary *attribute = @{NSForegroundColorAttributeName:[UIColor whiteColor]}; [[UITabBarItem appearance] setTitleTextAttributes:attribute forState:UIControlStateNormal];

Categories : IOS

"You Must Define An Input Directory" application loader error
I know this has nothing to do with the file because anything that select returns the same error. A week ago I did an upload normally with the 2.4.1 version of the application loader, but now it seems that Apple has restricted upload to the latest versions of the AL and XCode. If you can upgrade, do it, otherwise (like me), wait, but can be long.

Categories : IOS

Create or update function of realm framework not working in iOS
It doesn't look like you are setting the categoryID property on your objects. This would cause all of them to use the same primary key and overwrite the same object when using createOrUpdate To debug and step into the Realm code you will probably need to build from source.

Categories : IOS

NSArray of NSArrays: Get value of index of contained array
You have to construct it yourself. There's no one-liner to do it: NSMutableArray* secondItems = [[NSMutableArray alloc] initWithCapacity:arrObjects.count]; for (NSArray* element in arrObjects) [secondItems addObject:element[1]];

Categories : IOS

Swift UILabel is nil (error) when app goes in background
Rather than trying to hold a reference to your view controller from your app delegate, it is better to simply have your view controller subscribe to the foreground entry event - In your viewDidLoad add the following NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("enteringForeground:"), name: UIApplicationWillEnterForegroundNotification, object: nil) The add a funct

Categories : IOS

Xcode module import errors
You will frequently see this kind of linker error when the sources files containing a particular definition you are using are not being compiled, despite their declarations being in a header file you are importing. You can fix this by adding the appropriate source files to the "Compile Sources" build phase of your project. In this particular case, you need to include the AMBubbleTableViewControl

Categories : IOS

How do I transition back to the GameScene in SpriteKit?
The funny thing is that I just had the same problem as you. It took me a while, but I solved it by adding this to GameScene: override init(size: CGSize) { super.init(size: size) } Give it a try!

Categories : IOS

Linker error when converting Obj-c iOS app to Swift
On your link (Apple Dev)... you must check again "Importing Swift into Objective-C" :) In your ViewController.m... remove this line: #import "Chunk.h" and add this line: #import "Foo-Swift.h" "The file:<#YourProjectName#>-Swift.h should already be created automatically in your project, even if you can not see it." UPDATE If Chunk.swift is descendant of an Objective-C class.. replace

Categories : IOS

Send Push notification text to UItableview
Retrieve the current push notification's text in the AppDelegate and add it to an array. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions [...] { NSMutableArray *alertTextArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"alertTextArray"]; NSDictionary *notifKey = launchOptions[UIApplicationLaunchOptionsRemoteNot

Categories : IOS

Storing bool in shared NSUserDefaults always returns false
Don't use alloc/init for NSUserDefaults. It's a singleton. You're supposed to use the class method standardUserDefaults to get a pointer to the shared user defaults object: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

Categories : IOS

iOS Method Declaration Troubles
It isn't clear what you're asking. You want to have a public method alertStatus that can be called from outside? So just add this line just below the declaration of LoginClicked: - (void)alertStatus; (Note that method names should always start with a lower-case letter, so LoginClicked should be named loginClicked.) Note that from any class that wants to call methods in ViewController, you ne

Categories : IOS

kPFCachePolicyCacheThenNetwork Cache Miss
If you want to check for the cache miss you should check for error code 120. Just return (without presenting your UIAlertView) if you see that code. If you want to show the error message only after the 1st time the error is seen, save a flag in NSUserDefaults that indicates the first cache miss has been encountered, and check for error code 120 and that the NSUserDefaults flag is not set. I'm no

Categories : IOS

Quickblox Users - Sort and filter by tags
It is not achievable with current Users module. You could get this working with CustomObjects User class. If you have questions regarding CustomObjects please refer to documentation or post your questions here.

Categories : IOS

Swift: Navigate to new ViewController using button
First off as I explain in this answer, you need to drag the segue from the overall UIViewController to the next UIViewController, i.e. you shouldn't specifically connect the UIButton (or any IBOutlet for that matter) to the next UIViewController if the transition's conditional: You'll also need to assign an identifier to the segue. To do so, you can select the segue arrow then type in an identi

Categories : IOS

display Push notification text in a UIAlert View
You can put this code to the didFinishLaunchingWithOptions section and then display the pushText variable in a UIAlertView. NSDictionary *notifKey = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]; if (notifKey) { pushText = [notifKey objectForKey:@"alert"]; }

Categories : IOS

Can I implement google analytics for web-view/browser within IOS app?
yup you can track the traffic. Set up campaign tracking from where its forwarded. GA will then capture this information and attribute to the corresponding channel. You need to setup e-commerce tracking in the web property as well.

Categories : IOS

NSURLRequest Probelm with XCode 6.1
import UIKit class ViewController: UIViewController { @IBOutlet weak var wv: UIWebView! func loadUrl(){ wv.loadRequest(NSURLRequest(URL: NSURL(string: "http://www.google.de/")!)) } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. loadUrl() } override func didRecei

Categories : IOS

Tracking user without account, installation persistent
Using the keychain for something other than it's intended purpose will get your app rejected if Apple notices that you're doing it. The only question is whether or not they will notice, I don't know. Since this also violates the user's privacy, there is some risk your developer account might also be deleted. Apple doesn't like it when App developers do violate user privacy. Apple has previously b

Categories : IOS

How to find out expected size of Xcode's app icons
You can check the Apple guidelines: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/IconMatrix.html

Categories : IOS

dismissViewControllerAnimated not working 4
sounds like something off in you segues ... i did a quick test in the following way: create two view controllers in the story board ,each has it own navigation controller. crate a segue from the first view controller to the second one. 2 in the first view controller i added a bar button that preform the segue from 2. 3 to the second view controller i added a bar button with an action that di

Categories : IOS

how to embed navigation controller in a view programmatically?
Create a new instance of UINavigationController, with your StackTableViewController as its rootViewController. Then present the navigation controller: - (IBAction)pushToNextViewController:(id)sender { StackTableViewController *vc = [[StackTableViewController alloc]init]; UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:vc]; [self presentVi

Categories : IOS

Xcode 6 using multiple storyboards
I figured out an answer myself. The code is slightly different but it works very well. As said above by Matt, it's important to put NSLogs in your code so you know what is running and what is not. The first thing is I was using this code for a landscape app. There is a simple fix for this. You have to change the word Height to Width. The other thing is this will not work for the iPhone 6 or 6 plus

Categories : IOS

iOS 7 Auto Layout vs. iOS 8 Adaptive Layout, is there a difference?
Working with autolayout in iOS 7 and iOS 8 is the same. Adaptive layout is really just an umbrella term for all the new layout tools in Xcode 6 and iOS 8-- one of which being Autolayout. Though autolayout isn't new, it's still a part of the adaptive layout toolset, and it's much improved in iOS 8. Other adaptive layout tools include Size Classes and Adaptive Fonts. I recommend reading this Ray Wen

Categories : IOS

UIActivityIndicatorView startAnimating not working in searchBarSearchButtonClicked
You cane use SVProgresshood , a famous class for activity indicator. Download it from here Copy SVProgressHUD folder to your project. #import "SVProgressHUD.h" to your required ViewController. Where you start to Animate Activity indicator write : [SVProgressHUD showWithStatus:@"Loading.."]; And where to stop the activity indicator , write : [SVProgressHUD dismiss]; You can set your own

Categories : IOS


Recently Add
keychain iOS touchId prompted twice
-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7fc748e37ea0'
Search Results Visibly Scrolling Underneath the Status Bar
How do I exclude an IOS 8 app extension from a build?
EXC_BAD_ACCESS when capturing a GPU frame
iOS 8 - Map keeps reanimating back to user location
Constantly refreshing background image of UIImageView IOS
UINavigationController keeps displaying popped view
Swift closure syntax using Shark Food Mute Switch?
MagicalRecord 3.0 not saving. No objects for the second build
iOS / Swift Can't add gesture to child class
iOS: Is there currently a way to prevent two view controllers being pushed or popped at the same time?
Checking if array contains two objects
How should turning of SCNLight affect background color?
Why don't my views show up in Storyboards and are greyed out in the left pane?
SWIFT convert NSTimeInteval to NSDate
BLE scanning is stopped when go to background?
Drawing a Rect on UIView
HLS playback via local HTTP server on iOS
Re-Assigning SKScene delegate protocol
Network lost on screen lock unlock
Annoying Xcode Error "file not found" #import
CoreData not firing faults
iOS:How do you change a view size/origin from another view controller class?
Changing a frame in viewDidLayoutSubviews
Animate multiple shapes in UIView
Add NSIntegers ONLY when 2nd NSInteger Changes Value
Facebook SDK, fetching friends
How to get Storyboard to support dynamically sized cells in UICollectionView?
GCD / NSOperationQueue EXC_BAD_ACCESS
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.