Comments (14)
When I paused the execution in Xcode.... program is stuck on this piece of Apple provided code
void
dispatch_once(dispatch_once_t *predicate, dispatch_block_t block);
DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
_dispatch_once(dispatch_once_t _predicate, dispatch_block_t block)
{
if (DISPATCH_EXPECT(_predicate, ~0l) != ~0l) {
dispatch_once(predicate, block);
}
}
..... exactly on dispatch_once(predicate, block); function
from larsadcontroller.
That's a pretty basic couple of lines of code. If it's hanging anywhere it is in the allocWithZone:
method of the superclass, which is simply an NSObject
. So there's really not much that can fail here, unless you have your project setup incorrectly with regards to ARC/Non-ARC.
from larsadcontroller.
ARC is disabled....
only missing thing was the compiler flag for LARSadcontroller.m .. I even added that ..... but still same issue
This code works fine on simulator but only hangs on iPhone ....
from larsadcontroller.
Now I created a new project and its getting stuck on same line with Simulator and Device :(
from larsadcontroller.
It's your environment. There is nothing wrong with the code you're talking about. I can say that with confidence because the section in question that it's "hanging" on is all Foundation code and not my own. Try cleaning your build, deleting the app from both the simulator and the device, close Xcode, and restart your computer.
Also, try running the sample project included with the source code.
from larsadcontroller.
Okie..its all happening due to threading...if i remove this dispatch_once thing then it works fine...only thing is that it keeps loading again and again
from larsadcontroller.
That's because dispatch_once is the singleton initializer that guarantees that the system will only call it once and it will be a no-op on subsequent calls
from larsadcontroller.
How about i use some global variable value to determine ... if it needs to be instantiated ?
from larsadcontroller.
That's exactly what static dispatch_once_t onceToken;
is doing. After the token is set on the first execution (thus why you are passing it in by reference to dispatch_once
with &onceToken
), dispatch_once
does not fire what is in it's block. Are you calling these methods from a thread other than the main thread?
This code is running fine on tens of thousands of devices in production.
from larsadcontroller.
I know your code is fine..... it works in other project made by me
I am calling this code in view will appear of the first View Controller that the app loads .... i created a new project .... with only one view controller then it worked fine.... now as soon as i included my other view controllers (already written previously)........ same behavior is returned....
from larsadcontroller.
Not sure what to say without seeing the project.
from larsadcontroller.
could this be possible reason
"dispatch_once will deadlock if the something in the -init method calls the +singleton method. "
source : http://cocoasamurai.blogspot.com/2011/04/singletons-your-doing-them-wrong.html
from larsadcontroller.
wait a minute .... i just checked that i load data from files in my app delegate.... in function didFinishLaunchingWithOptions
if i remove data load function then ads are displayed......
from larsadcontroller.
I created a global variable which i initialize in didFinishLaunchingWithOptions function in delegate......
In rest of code in just refer to this variable which is of type LARSAdController.
Problem Solved :)
from larsadcontroller.
Related Issues (20)
- google ads set to appear at top, which are not full-screen width, are placed in top left, not top center. HOT 9
- Blank Presenting View when Added as Subview iOS 8 HOT 2
- Banner position in runtime HOT 5
- GADBannerViewDelegate.h not found - first issue HOT 7
- GADBannerViewDelegate.h not found HOT 9
- Notification on bannerViewActionShouldBegin and bannerViewActionDidFinish HOT 3
- apps orientation settings not inherited? HOT 1
- error "Include of non-modular header inside framework module " HOT 5
- Ads in a list view? HOT 1
- 'interfaceOrientation' is deprecated: first deprecated in iOS 8.0 HOT 1
- Having trouble hiding AdBanner when no ad is visible HOT 11
- Build Error: 'GADBannerViewDelegate.h" not found HOT 11
- Delete HOT 2
- Global Disable Without Subclassing HOT 2
- iPad ContainerView Height Wrong? HOT 1
- 3.1.1 Causing freezing with Google Mobile Ads 7.5.2
- originalContentView with iAds
- In Landscape mode, when using Split View multitasking, ad container is wrong. (found fix!) HOT 3
- Carthage
- Portrait ads do not display correctly on iPad Pro 12.9" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from larsadcontroller.