Understanding the Issue with Wikitude Black Screen on iOS 8.3
===========================================================
In this article, we will delve into the world of augmented reality (AR) development using Wikitude SDK for iOS. Specifically, we will explore a common issue that causes a black screen when using the camera and GPS features.
Background Information on Wikitude SDK
Wikitude is an open-source framework for developing AR experiences. It provides a comprehensive set of tools and libraries to enable developers to build immersive and interactive AR applications. The SDK supports various platforms, including iOS and Android, making it a popular choice among AR enthusiasts and professionals alike.
Understanding the Code
The provided code snippet is written in Objective-C and appears to be part of an iOS project using Wikitude SDK. We can see that the viewDidLoad
method is used to initialize the WTArchitectView
, which is the core component of the Wikitude framework. The code sets up the necessary permissions for camera and GPS access, loads the architect world from a URL, and starts running the application.
However, there’s an interesting part in the code:
if ( ![self.architectView isRunning] ) {
[self.architectView start:^(WTStartupConfiguration *configuration) {
configuration.captureDevicePosition = AVCaptureDevicePositionBack;
} completion:^(BOOL isRunning, NSError *error) {
if ( !isRunning ) {
NSLog(@"WTArchitectView could not be started. Reason: %@", [error localizedDescription]);
}
}];
}
Here, we can see that the start
method is called on the architectView
. This method takes a completion block as an argument. The completion block checks if the view has started successfully and logs any errors that may occur.
Identifying the Issue
The problem lies in the fact that the camera feature requires additional setup to work properly. According to Wikitude documentation, you need to add the -ObjC
linker flag for both Debug and Release builds on Build Settings.
Adding this flag ensures that the Objective-C runtime is linked to your project, which is necessary for the camera feature to function correctly.
Solution
To fix the issue with the black screen on iOS 8.3, we need to add the -ObjC
linker flag to our Build Settings:
- Open the Xcode project navigator and select your target.
- Click on the “Build Settings” tab in the toolbar.
- Scroll down to the “Linker Flags” section.
- Add
Other Linker Flags
with a value of-ObjC
. - Repeat the same steps for both Debug and Release builds.
By adding this flag, you ensure that the Objective-C runtime is linked to your project, which allows the camera feature to work correctly.
Conclusion
In conclusion, understanding the issue with the Wikitude black screen on iOS 8.3 involves examining the provided code snippet and identifying the problem lies in the camera feature not being properly set up. Adding the -ObjC
linker flag to Build Settings resolves this issue by ensuring that the Objective-C runtime is linked to your project.
To avoid similar issues in the future, make sure to include all necessary flags when setting up your project:
Other Linker Flags: -ObjC
Debug Information Format: Dwarf 5
(optional)Linkage Editor: system
By following these steps and adjusting your Build Settings accordingly, you can enjoy seamless AR experiences using Wikitude SDK.
Troubleshooting Tips
Adding Linker Flags to Your Project
If you are having trouble finding the link flags in Xcode:
- Open your project navigator.
- Select your target.
- Click on the “Build Settings” tab in the toolbar.
- Scroll down to the “Linker Flags” section.
By following these steps, you can easily add linker flags to your Build Settings and resolve any issues that may arise during AR development using Wikitude SDK.
Common Issues
Some common issues that users encounter when setting up their project with Wikitude SDK include:
- Camera not working: Make sure that the camera feature is enabled in your
WTArchitectView
configuration. - Black screen or crashing: Ensure that the
-ObjC
linker flag is added to your Build Settings, and verify that the Objective-C runtime is linked to your project.
By addressing these potential issues and following the steps outlined in this article, you can successfully integrate Wikitude SDK into your iOS project and create stunning AR experiences.
Last modified on 2024-10-14