Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 848 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Swift project crashing with Thread 1: EXC_BAD_ACCESS (code = 1, address = 0x0)

#1
It looks like a bad memory access, like trying to access an object that does not exist. I tried using NSZombie to see if something came up, as far as I could tell nothing did. It is crashing at the declaration for the app delegate.

AppDelegate.swift

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
{
var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]) -> Bool
{
// Override point for customization after app launches
Parse.setApplicationId("removed on purpose", clientKey: "removed on purpose")
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
PFFacebookUtils.initializeFacebook()

return true
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String, annotation: AnyObject?) -> Bool
{
return FBAppCall.handleOpenURL(url, sourceApplication: sourceApplication, withSession: PFFacebookUtils.session())

}

func applicationDidBecomeActive(application: UIApplication)
{
FBAppCall.handleDidBecomeActiveWithSession(PFFacebookUtils.session())
}

func applicationWillResignActive(application: UIApplication)
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication)
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

}

func applicationWillEnterForeground(application: UIApplication)
{
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationWillTerminate(application: UIApplication)
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

DashboardViewController.swift

import UIKit

class DashboardViewController: UIViewController
{
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view
}

}
Using breakpoints I have determined that it is not even getting past the class declaration for the app delegate. I tried checking all of the classes in my Main.storyboard file as well to make sure everything was linked properly, again as far as I can tell it is.
Reply

#2
_Solution from OP._

Problem solved by fixing the code as below.

In all method signatures, replace:

application: UIApplication

with:

application: UIApplication!

And in `application:didFinishLaunchingWithOptions:`, replace:

launchOptions: [NSObject : AnyObject]

with:

launchOptions: NSDictionary!
Reply

#3
Works with Xcode 6.1:

Try

PFAnalytics.trackAppOpenedWithLaunchOptionsInBackground(launchOptions, block: nil)

instead of

PFAnalytics.trackAppOpenedWithLaunchOptions()
Reply

#4
I ran into the same issue today. As of Xcode 6 beta 6 the auto complete suggests:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]) -> Bool {}

This crashes at startup with an EXC_BAD_ACCESS and a blank screen.

As soon as an `!` is added to the last argument, everything works fine:

func application(application: UIApplication,didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]!) -> Bool {}

In [current documentation][1] the `!` is missing as well:

optional func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]) -> Bool

[1]:

[To see links please register here]

:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through