appdelegate

How to set different AppDelegate for different targets within same project?

十年热恋 提交于 2019-12-10 12:19:57
问题 I'm very very new to the target concept in Xcode. I have followed this tutorial to learn to create two targets in the same project. I just want to know how to make target A use AppDelegateA.swift as its designated app delegate, and target B use AppDelegateB.swift as its designated app delegate. Because on the tutorial, it actually teaches how to make two apps from the same AppDelegate. But I make two (almost) completely different apps, that share a lot of resources and libraries. And while we

Can I use PushKit to do regular push with out using VoIP? Will it allow killed app to be launched in background if user does not act on notification?

﹥>﹥吖頭↗ 提交于 2019-12-09 14:19:52
问题 In the PushKit it is mentioned we can use regular push or VoIP push. But I did not find any documentation for what PKPushType to use for regular push. Did anybody try the regular push using the PushKit? If I don't use VoIP is it possible for a killed app to be launched in the background if it receives push notification? Meaning if app is killed and a notification comes and user does not act on it, can the app be launched by iOS in the background if I use PushKit? 回答1: Since iOS 13.0, this is

iPhone registerForRemoteNotificationTypes does not generate an error but does not fire delegate that gives device token

99封情书 提交于 2019-12-09 05:09:13
问题 I am developing an iPhone app that needs push notification. I followed the instructions for creating the certifications and modifying the app ID. I am not totally sure I did this correctly, but I did follow the directions. Any idea how I can check to see if this is OK? When I ran in the emulator I did get an error message saying that the emulator did not support push notifications. This was somewhat expected. BTW: I have seem this question out there a few times. It always seems to be with a

Call class method with argument from another class method

為{幸葍}努か 提交于 2019-12-09 03:49:27
问题 In my code file MyItemVC.swift I have defined the following class and method: class MyItemVC: UIViewController, UITextViewDelegate { var timer = NSTimer() func cycleTimer(toggleOn: Bool) { if toggleOn == true { // Timer calls the replaceItem method every 3 seconds timer = NSTimer.scheduledTimerWithTimeInterval(3, target: self, selector: Selector("replaceItem"), userInfo: nil, repeats: true) } else { timer.invalidate() // stop the timer } } } Elsewhere in this class, I call cycleTimer(true) to

whose view is not in the window hierarchy - email form

随声附和 提交于 2019-12-08 12:59:51
问题 I'm calling a method from viewcontroller in an appdelegate. When I was testing functionality I just used NSLog message which works fine (so the connection between viewcontroller and appdelegate is OK). The problem appears once I add a email form into this method. The message I receive is: Warning: Attempt to present <MFMailComposeViewController: 0x1fdc3990> on <ViewController: 0x1fd9e3b0> whose view is not in the window hierarchy! Anyone who know what to do? I know there are lot of topics

After opening iOS app “continue userActivity:” method isn't called - Firebase dynamic link

≡放荡痞女 提交于 2019-12-08 12:39:47
问题 I have successfully integrated Firebase dynamic links and when I click on dynamic link then my app is opening. The issues I'm facing is after opening app from dynamic links, continue userActivity: method should be called, but nothing happens. I've checked the all the possible thing but didn't recognised the issue. I've searched the SO for this but none of the answer helped me. My Code: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:

Swift for OsX WebFrameLoadDelegate doesn't works

*爱你&永不变心* 提交于 2019-12-08 12:25:31
问题 I am new in OSX developing and i am new in Swift. I want to write simple app with WebView. I can load url, but I need to catch event when, WebView end loading content. it's my app delegate.swift file: import WebKit class AppDelegate: NSObject, NSApplicationDelegate{ @IBOutlet weak var window: NSWindow! @IBOutlet var webview: WebView! func applicationDidFinishLaunching(aNotification: NSNotification?) { let url = NSURL(string: "google.com") let request = NSURLRequest(URL: url); webview

How to block iOS 7 control centre from controlling music app?

有些话、适合烂在心里 提交于 2019-12-08 09:50:38
问题 Our app explicitly blocks user form using remote-control, e.g., old springboard from pre-iOS7, earbud, by becoming the first responder to the remote-control events. However, on iOS7, the same code fails to bypass the control centre music controls. From out tests, control centre seems to have bypassed ALL music control events including UIEventSubtypeRemoteControlPause and UIEventSubtypeRemoteControlPlay, and UIEventSubtypeRemoteControlTogglePlayPause. Is it that control centre has its own

How to properly use the completionHandler when performing a background fetch?

假如想象 提交于 2019-12-08 04:32:02
问题 I'm having a hard time wrapping my head around using completionHandler inside performFetchWithCompletionHandler in the AppDelegate . My App does some background fetching, and during the fetch I would like to invoke a function that is located in one of my viewControllers What is the correct way to use the completionHandler , I'm aware that it is an asynchronous task. I managed to make it work when I wanted to send data to my database, but I'm unable to make it work when I want to invoke a

How to pass data from AppDelegate to ViewController?

别等时光非礼了梦想. 提交于 2019-12-08 02:15:03
问题 I'm using Safari to browse a webpage. After I click a button on this page, my Ipad will launch my app. So I implement the method - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url in the AppDelegate.m . - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{ if (!url) { return NO; } NSString *URLString = [url absoluteString]; self.paramArray = [URLString componentsSeparatedByString:@"@"]; NSLog(@"%d",[self.paramArray count]); for (int i = 1; i <