I'm trying to get a Live View to work in a Swift Playground. Whenever I import the XCPlayground framework to execute the XCPShowView function i get this error:
Playground execution failed: error: Couldn't lookup symbols:_CGPointMake
The error changes for a few other "symbols" as well, including CGRectMake. I've tried clearing my Xcode beta 5 cache directory as well as re-installing Xcode.
Try with this:
instead of using
CGSizeMake(200, 200)
use this (without the "Make")
CGSize(width: 200, height: 200)
The same with CGPointMake / CGPoint, CGRectMake/CGRect...
I'm experimenting with sprite kit in a playground, and I had the same problem.
For me it helped with NSPoint(x:y:) and NSRect(x:y:)
Related
I had programmed and used a software for a year without problems but after updating to Monterey and updating XCode, the following, simplified Playground example of the process always fails and I cannot figure out why. Please note this project is specifically written for macOS and I cannot use the iOS libraries for PDF generation.
import WebKit
import PDFKit
import SwiftUI
import CoreGraphics
let webView: WKWebView = WKWebView(frame: CGRect(x: 0, y: 0, width: 595.0, height: 842.0), configuration: WKWebViewConfiguration())
let htmlString = "<html><body><h1>Hello</h1></body></html>"
webView.loadHTMLString(htmlString, baseURL: nil)
webView.createPDF(completionHandler: compHandler)
func compHandler(res: Result<Data, Error>) -> Void {
print(res)
}
This always results in an error:
failure(Error Domain=WKErrorDomain Code=1 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred})
I cannot find anything in the documentation regarding this and most examples and questions are old and not applicable (many still using Objective-C).
Debugging seems to suggest that the loadHTMLString itself fails, not even necessarily the PDF itself.
Any pointers would be appreciated.
Thanks
I'm reading through the official document for NativeScript, and come across this playground example code related to "BottomNavigation".
https://play.nativescript.org/?template=play-ng&id=U4Rmr9&v=2
I tried to replicate the code using:
tns version "8.0.2"
angular cli version "12.0.5"
And I this error when running "tns run ios", stating that "Root should be either UIViewController or UIView".
I tried google for solutions, come across solution like this:
"Error: Root should be either UIViewController or UIView" Nativescript
I tried wrapping the entire "BottomNavigation" or just the "page-router-outlet", but still get weird results.
Can anybody help me with this?
I've created a git repo to simulate the issue:
https://github.com/HidePoSy/TestNativeScriptBottomNavigation.git
All that's need to run it is run "tns run ios".
Thanks.
I'm trying to use Hyperloop in order to use a third-party open source library. The library I want to use is Sweet Alert iOS.
The library has a swift file. I have put this file inside an src directory inside my project's main folder (does it have to be inside src folder? can I use other folder in my project? what about sub-directories?).
According to the Titanium documentation:
Any *.swift files found in your src directories will automatically be compiled
In my app when I do something like this:
var UIView = require('UIKit/UIView');
Ti.API.info('UIView => ' + UIView);
It works. But if I try to require any of the classes in the swift file I get an error that it can't find architecture x86_64 module.
var sweetAlert = require('SweetAlert');
var cancelAnimatedView = require('CancelAnimatedView');
When looking at the SweetAlert source code, I also notice that SweetAlert class is open while other classes are just regular classes:
open class SweetAlert
I'm not a swift developer so I don't really know what it means.
What am I missing here?
EDIT
Some progress... So I found that I need to have an appc.js file that's defining the src frame work and a name for MyFramework. And that the require I do should match the filename of the swift file. Now when I compile I see some more interesting output about the swift compilation, but getting an error:
[INFO] Generating metabase for swift MyFramework /Users/ophir/Documents/Appcelerator_Studio_Workspace/HyperloopTest1/src/SweetAlert.swift
2017-06-29T14:43:44.061Z | ERROR | An uncaught exception was thrown!
Cannot read property '1' of null
2017-06-29T14:43:44.064Z | ERROR | Cannot read property '1' of null
EDIT 2
I've cleared all the script in the swift file, and narrowed it down to the following failing script:
import Foundation
import UIKit
import QuartzCore
public enum AlertStyle {
case success,error,warning,none
case customImag(imageFile:String)
}
class SweetAlert: UIViewController {
}
class AnimatableView: UIView {
func animate(){
}
}
If I remove the func animate() { } it will not fail. Even if this function is inside that one SweetAlert class then it will fail. And from what I've read this is a pretty standard swift code.
So this makes me wonder - is Hyperloop 2.0.0(!) ready for production apps?
I receive a similar error when creating a simple Swift class and including it in a Titanium/Appcelerator project with the appc.js file set up just how they show in the sparse documentation. The project will compile with no issues and run in the Xcode Simulator, as long as I don't reference the class from the Swift file. If I reference that class in the project, the error arises. Based on the compile log, Swift files do compile into the project, but the classes don't seem to properly link in the end for "require"-ing into the JavaScript code.
When I search online for solutions, this same issue shows up all over, and the Titanium/Appcelerator team never presents a solution. I've tried Titanium SDK 6.0.1, 6.1.2, and 6.2.0, with all the same results; I've tried adding Swift code to existing projects and to new ones; I've also uninstalled and reinstalled Titanium/Appcelerator. (I've even tried running their sample app with no luck!)
Hyperloop does work when I use native frameworks, like UIKit, but it doesn't seem ready for production apps for 3rd party frameworks and classes.
I hope my discoveries help you and others to debug projects, but, unfortunately, I don't think I will be able to offer much help outside that.
I am trying everything under my power here to insert jquerymobile.1.0.1 into an extension I have build for firefox.
I can install, link to any other script and everything seems to work just fine, but have had an assortment of errors getting jquerymobile to work.
I've tried uploading through the add-on builder
I've tried remotely linking the file
I've tried copying and pasting the file into other code.. nothing works.
I've coded this extension for safari, chrome and opera without issue, but Firefox chokes the second I link to/include jquerymobile in my code returning this error:
Timestamp: 12-04-27 12:10:33 PM
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHistory.replaceState]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://jid0-d4zlaxz3cfuahkcdoecsmya637m-at-jetpack/idesireit/data/js/jquery.mobile-1.0.1.min.js :: :: line 72" data: no]
and also an error about "unallowed unicode" which I didn't get the chance to copy or paste, but I haven't seen that one in a few saves...
I've read that the above error can be caused by cross domain functions, but all my cross domain functions are in another js file, and they are all working just fine ( judging by those I can navigate to with jquerymobile acting as it is right now )
I'm a novice - if my error is based on my stupidity, please go lightly :O
I went ahead and created an all new extension,
included nothing but the popup, and in that pop up, called jquery and jquery.mobile.
I got this error instantly again.
I'm just going to go ahead and use the alternative UI I'm using on the dashboard widget, I've wasted too much time on this.
The bug is in the addonsdk, not in JQ Mobile. Any attempt to access or manipulate the window.history object in a panel will raise this error.
I'm using Xcode 4.2 and Three20 to create app that can be run on all iOS.
When I run the app on iPhone 3G having iOS 3.0,
I see a crash with the following message in the Debug Console:
dyld: Symbol not found: _OBJC_CLASS_$_UIPopoverController
Referenced from: /var/mobile/Applications/7AB01877-55F2-4A5F-A835-FF7849D6E285/Xcode4M.app/Xcode4M
Expected in: /System/Library/Frameworks/UIKit.framework/UIKit
I followed this this SO and fix the crash.
Now I receive another crash with this message:
dyld: Symbol not found: _OBJC_CLASS_$_UISplitViewController
Referenced from: /var/mobile/Applications/7AB01877-55F2-4A5F-A835-FF7849D6E285/Xcode4M.app/Xcode4M
Expected in: /System/Library/Frameworks/UIKit.framework/UIKit
I tried to fix this crash with the same method, but not succeeded.
Do you know how to fix this?
Edit: (Add problematic code)
File: TTSplitViewController
#interface TTSplitViewController : UISplitViewController
<UISplitViewControllerDelegate, TTNavigatorRootContainer> {
#private
TTNavigator* _leftNavigator;
TTNavigator* _rightNavigator;
UIBarButtonItem* _splitViewButton;
id _popoverSplitController;
}
yes. you can see the code in the pull request at https://github.com/facebook/three20/pull/695/files. It solves all 3.1 issues, besides the TTSplitViewController.
it uses a special function of three20 to create a UIPopViewController
_popoverController = [[TTUIPopoverControllerClass() alloc] init];
if (_popoverController != nil) {
[_popoverController setContentViewController:controller];
[_popoverController setDelegate:self];
}
You will still need to comment out TTSplitViewController, however that's the only class that has an issue with iOS 3.1. (see the comments in the pull request)
I uncheck TTSplitViewController.h and TTSplitViewController.m in the Target Membership.
and comment the line
//#import "Three20UI/TTSplitViewController.h"
in Three20UI.h
and uncheck UISplitViewController+TTNavigator.h and UISplitViewController+TTNavigator.m from their Target Membership.
and comment the line
//#import "Three20UICommon/UISplitViewController+TTNavigator.h"
in Three20UICommon+Additions.h
I works, but I would prefer to do something like this SO so I can use these classes later. I'd be glad if someone know how to do it.